diff --git a/src/plugins/e-acsl/E_ACSL.mli b/src/plugins/e-acsl/E_ACSL.mli index b67c7aa3dda14d0fe5fcdd1df218cd41cc7c641e..8143d74b52dcb92e41f84901af704c37e6f423f3 100644 --- a/src/plugins/e-acsl/E_ACSL.mli +++ b/src/plugins/e-acsl/E_ACSL.mli @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/e-acsl/INSTALL b/src/plugins/e-acsl/INSTALL new file mode 100644 index 0000000000000000000000000000000000000000..fcd230c69cd6a0528c09cc96a263172bed79423f --- /dev/null +++ b/src/plugins/e-acsl/INSTALL @@ -0,0 +1,143 @@ + ------------------------- + INSTALLATION INSTRUCTIONS + ------------------------- + +=============================================================================== + SUMMARY +=============================================================================== + +0) Summary +1) Quick Start +2) Requirements +3) Configuration +4) Compilation +5) Installation +6) Custom Installation +7) Testing the Installation +8) Uninstallation +9) Have Fun with E-ACSL! + +=============================================================================== + QUICK START +=============================================================================== + +1) Install Frama-C if not already installed. + +2a) On Linux-like distribution: + ./configure && make && sudo make install + +2b) On Windows+Cygwin or Windows+MinGW+msys: + ./configure --prefix C:/windows/path/with/direct/slash && make && make install + +4) Optionally, test your installation by running: + frama-c.byte -e-acsl tests/e-acsl-runtime/true.i -then-on e-acsl -print + frama-c -e-acsl tests/e-acsl-runtime/true.i -then-on e-acsl -print + +See below for more detailed and specific instructions. + +=============================================================================== + REQUIREMENTS +=============================================================================== + +- GNU make version >= 3.81 +- Objective Caml >= 3.10.2; +- Frama-C = Nitrogen-20111001 + (no warranty that this plug-in works with more recent version of Frama-C) + +- The native version of the plug-in is only available if native dynamic linking + feature of OCaml is available on your system (see Frama-C User Manual, + Section 3.1). +- Optionally, the GMP library >= ??? + It is required to run the tests and to run the generated programs, + but not to run the plug-in through Frama-C. + +=============================================================================== + CONFIGURATION +=============================================================================== + +The E-ACSL plug-in is configured by "./configure [options]" + +configure is generated by autoconf, so that the standard options for setting +installation directories are available, in particular '--prefix=/path'. + +Under Cygwin or MinGW: +---------------------- +Use "./configure --prefix C:/windows/path/with/direct/slash". + +=============================================================================== + COMPILATION +=============================================================================== + +Type "make". + +Makefile targets of interest are: +- doc generates the API documentation + +=============================================================================== + INSTALLATION +=============================================================================== + +Type "make install" +(depending on the installation directory, may require superuser privileges). + +It is possible to install in a given directory by setting +the DESTDIR variable: "make install DESTDIR=/tmp" installs Frama-C in +sub-directories of /tmp. + +The following files are installed. + +Object files: (usually in `frama-c -print-plugin-path`) +------------- +- E_ACSL.cmi +- E_ACSL.cmo +- E_ACSL.cmxs (only if native dynamic linking of OCaml is available) + +Shared files: (usually in `frama-c -print-share-path`/e-acsl) +------------- +- e_acsl.h +- e_acsl_gmp.h +- e_acsl_gmp_types.h + +Manuals: (usually in `frama-c -print-share-path`/manuals) +-------- +- e-acsl.pdf +- e-acsl-implementation.pdf + +=============================================================================== + CUSTOM INSTALLATION +=============================================================================== + +You can manually move any installed files. However, in such a case, you have to +set specific environment variables in order that Frama-C found the appropriate +objects when required. + +The environment variables are: +------------------------------ +FRAMAC_SHARE: absolute path to the Frama-C share subdirectory +FRAMAC_LIB: absolute path of the Frama-C lib subdirectory +FRAMAC_PLUGIN: absolute path of the Frama-C plug-in directory. + +=============================================================================== + TESTING THE INSTALLATION +=============================================================================== + +This step is optional. + +Test your installation by running: + frama-c.byte -e-acsl tests/e-acsl-runtime/true.i -then-on e-acsl -print + frama-c -e-acsl tests/e-acsl-runtime/true.i -then-on e-acsl -print + +The second command only works if native dynamic linking of OCaml is available +on your system. + +=============================================================================== + UNINSTALLATION +=============================================================================== + +Type "make uninstall" to remove Frama-C and all the installed plug-ins. +That works only if you have not manually moved the installed files (see Section +"Custom Installation"). + +=============================================================================== + HAVE FUN WITH E-ACSL! +=============================================================================== diff --git a/src/plugins/e-acsl/Makefile.in b/src/plugins/e-acsl/Makefile.in index d1de8fd647b8a744bb07c8758cbdb5f420245d6a..89093a7fb2d6f8c698a4a6da9d2f4b777964aaba 100644 --- a/src/plugins/e-acsl/Makefile.in +++ b/src/plugins/e-acsl/Makefile.in @@ -1,8 +1,8 @@ ########################################################################## # # -# This file is part of the E-ACSL plug-in of Frama-C. # +# This file is part of the Frama-C's E-ACSL plug-in. # # # -# Copyright (C) 2011 # +# Copyright (C) 2012 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -20,6 +20,10 @@ # # ########################################################################## +####################### +# Frama-C Environment # +####################### + # Do not use ?= to initialize both below variables # (fixed efficiency issue, see GNU Make manual, Section 8.11) ifndef FRAMAC_SHARE @@ -29,6 +33,19 @@ ifndef FRAMAC_LIBDIR FRAMAC_LIBDIR :=$(shell frama-c -journal-disable -print-libpath) endif +# OCAMLVERSION and HAS_OCAML312 are defined in Frama-C common Makefile +# but cannot be used at this point +OCAMLVERSION ?=@OCAMLVERSION@ +ifeq ($(findstring 3.12,$(OCAMLVERSION)),) +HAS_OCAML312 = no +else +HAS_OCAML312 = yes +endif + +######################### +# Plug-in configuration # +######################### + PLUGIN_DIR ?=. PLUGIN_ENABLE:=@ENABLE_E_ACSL@ PLUGIN_DYNAMIC:=@DYNAMIC_E_ACSL@ @@ -46,13 +63,16 @@ PLUGIN_CMO:= local_config \ main PLUGIN_HAS_MLI:=yes -# Enable -warn-error, but do not distribute the plug-in with this option being -# activated +# Enable -warn-error in development mode, but not in distribution mode +# Do not edit the line below: it is automatically set by 'make src-distrib' +IS_DISTRIBUTED:=no +ifneq ($(IS_DISTRIBUTED),yes) ifeq ($(HAS_OCAML312),yes) DEV_FLAGS=-warn-error +a else DEV_FLAGS=-warn-error A endif +endif PLUGIN_BFLAGS:=$(DEV_FLAGS) PLUGIN_OFLAGS:=$(DEV_FLAGS) @@ -60,13 +80,20 @@ PLUGIN_DISTRIBUTED:=no PLUGIN_DISTRIB_EXTERNAL:= Makefile.in configure.ac configure PLUGIN_DISTRIB_BIN:=no + +####################### +# Local configuration # +####################### + PLUGIN_GENERATED:= $(PLUGIN_DIR)/local_config.ml +VERSION=$(shell $(SED) -e 's/\\(.*\\)/\\1/' VERSION) + $(PLUGIN_DIR)/local_config.ml: $(PLUGIN_DIR)/Makefile.in $(PRINT_MAKING) $@ $(RM) $@ $(ECHO) "(* This file was automatically generated from $<. Don't edit it. *)" >> $@ - $(ECHO) "let may_use_assert = @MAY_USE_ASSERT@" >> $@ + $(ECHO) "let version = \""$(VERSION)"\"" >> $@ $(CHMOD_RO) $@ ########### @@ -95,10 +122,56 @@ install:: $(PRINT_CP) E-ACSL share files $(MKDIR) $(FRAMAC_SHARE)/e-acsl $(CP) $(E_ACSL_DIR)/share/e-acsl/* $(FRAMAC_SHARE)/e-acsl + $(CP) $(E_ACSL_DIR)/doc/manuals/e-acsl.pdf \ + $(E_ACSL_DIR)/doc/manuals/e-acsl-implementation.pdf \ + $(FRAMAC_SHARE)/manuals uninstall:: $(PRINT_RM) E-ACSL share files $(RM) -r $(FRAMAC_SHARE)/e-acsl + $(RM) $(FRAMAC_SHARE)/manuals/e-acsl.pdf \ + $(FRAMAC_SHARE)/manuals/e-acsl-implementation.pdf + +################################ +# Building source distribution # +################################ + +EXPORT =e-acsl-$(VERSION) + +DISTRIB_FILES= $(filter-out $(wildcard *local_config.ml), $(wildcard *.ml)) \ + $(wildcard *.mli) \ + configure.ac Makefile.in \ + doc/Changelog \ + doc/manuals/e-acsl.pdf doc/manuals/e-acsl-implementation.pdf \ + share/e-acsl/*.h \ + tests/test_config.in \ + tests/e-acsl-reject/test_config tests/e-acsl-reject/*.i \ + tests/e-acsl-runtime/test_config tests/e-acsl-runtime/*.i \ + license/CEA_LGPL license/headache_config.txt license/LGPLv2.1 \ + INSTALL README VERSION .depend + +src-distrib: .depend + $(PRINT_TAR) tmp-distrib + $(TAR) cf tmp.tar $(DISTRIB_FILES) + $(PRINT_MAKING) export directories + $(MKDIR) $(EXPORT) + $(PRINT_UNTAR) tmp-distrib + cd $(EXPORT); \ + $(TAR) xf ../tmp.tar; autoconf; \ + $(SED) -i -e 's/IS_DISTRIBUTED:=no/IS_DISTRIBUTED:=yes/' Makefile.in + $(PRINT_RM) tmp-distrib + $(RM) tmp.tar + $(PRINT_MAKING) test directories + for dir in $(EXPORT)/tests/*; do \ + if test -d $$dir; then \ + $(MKDIR) $$dir/result; \ + $(MKDIR) $$dir/oracle; \ + fi \ + done + $(PRINT_MAKING) archive + $(TAR) czf $(EXPORT).tar.gz $(EXPORT) + $(PRINT) Cleaning + $(RM) -fr $(EXPORT) ########## # Header # diff --git a/src/plugins/e-acsl/README b/src/plugins/e-acsl/README new file mode 100644 index 0000000000000000000000000000000000000000..7785bfc09f8db42bda758427ecea3c8b24931523 --- /dev/null +++ b/src/plugins/e-acsl/README @@ -0,0 +1,188 @@ + ------ + README + ------ + +=============================================================================== + SUMMARY +=============================================================================== + +0) Summary +1) What Is +2) Simple use +3) Examples +4) Advanced uses +5) Compatibility with previous releases +6) Have Fun with E-ACSL! + +=============================================================================== + WHAT IS +=============================================================================== + +This package contains the Frama-C's E-ACSL plug-in. It takes as input an +annotated C program and returns the same program in which annotations have +been converted into C code dedicated to runtime assertion checking: this code +fails at runtime if and only if the annotation is wrong in the execution +context. + +Annotations must be written in a subset of ACSL (ANSI/ISO C Specification +Language), namely E-ACSL (Executable ANSI/ISO C Specification Language). E-ACSL +is fully described in file doc/manuals/e-acsl.pdf. + +This plug-in is still under implementation: some parts of E-ACSL are not yet +implemented. What is supported is described in file +doc/manuals/e-acsl-implementation.pdf. + +Please read file INSTALL for details about the installation procedure of +this plug-in and consult http://frama-c.com and http://frama-c.com/e-acsl +for information about Frama-C and ACSL. + +=============================================================================== + SIMPLE USE +=============================================================================== + +The standard use is the following: + +$ frama-c -e-acsl <files> -then-on e-acsl -print -ocode generated_code.c + +Option -e-acsl runs the Frama-C's E-ACSL plug-in on the given <files>: it +returns a new Frama-C project called `e-acsl'. Option -then-on switches to +this project while options -print and -ocode pretty prints the corresponding C +code into file `generated_code'. + +Here the only E-ACSL specific option is -e-acsl. The others (-then-on, -print +and -ocode) are standard Frama-C options, described in the Frama-C User Manual +as well as the concept of Frama-C Project. + +The generated file is a C file which usually depends on the GMP library +(http://???). The following commands compile and run it: + +$ gcc generated_code.c -lgmp -o generated_code +$ ./generated_code + +The execution behaves in the same way than the original <files>, except that +it fails if an annotation is violated. + +=============================================================================== + EXAMPLES +=============================================================================== + +1) Consider the following C program: +<true.i> +int main(void) { + /*@ assert \true; */ + return 0; +} + +Since the assertion is always true, the generated code behaves in the same way +that just returning 0: +$ frama-c -e-acsl true.i -then-on e-acsl -print -ocode gen_true.c +$ gcc gen_true.c -o gen_true +$ ./gen_true +$ echo $? +0 + +As this example is trivial, the generated code does not require to be linked +against GMP. It is usually not the case. + +2) Now consider the following C program: +<false.i> +int main(void) { + int x = 0; + /*@ assert x+1 == 0; */ + return 0; +} + +Since the assertion is always false, the generated code fails at runtime: +$ frama-c -e-acsl false.i -then-on e-acsl -print -ocode gen_false.c +$ gcc gen_false.c -lgmp -o gen_false +$ ./gen_false +Assertion failed at line 7. +The failing predicate is: +(x+1 == 0). +$ echo $? +1 + +As this example uses arithmetic in annotations, the generated code must be +linked against GMP (GCC's option -lgmp) to be able to produce an executable. + +3) More advanced examples are available in directory tests/e-acsl-runtime. Note + that these examples never fail at runtime: all the annotations are valid. + +=============================================================================== + ADVANCED USES +=============================================================================== + +This E-ACSL plug-in is fully integrated within Frama-C: any standard Frama-C +options may be used in order to custom the Frama-C execution. Read the Frama-C +User Manual for additional information. + +The list of E-ACSL option is available through the option -e-acsl-help: +$ frama-c -e-acsl-help + +As this example is trivial, the generated code does not require to be linked +against GMP. It is usually not the case. + +2) Now consider the following C program: +<false.i> +int main(void) { + int x = 0; + /*@ assert x+1 == 0; */ + return 0; +} + +Since the assertion is always false, the generated code fails at runtime: +$ frama-c -e-acsl false.i -then-on e-acsl -print -ocode gen_false.c +$ gcc gen_false.c -lgmp -o gen_false +$ ./gen_false +Assertion failed at line 7. +The failing predicate is: +(x+1 == 0). +$ echo $? +1 + +As this example uses arithmetic's in annotations, the generated code must be +linked against GMP (GCC's option -lgmp) to be able to produce an executable. + +3) More advanced examples are available in directory tests/e-acsl-runtime. Note + that these examples never fail at runtime: all the annotations are valid. + +=============================================================================== + ADVANCED USES +=============================================================================== + +This E-ACSL plug-in is fully integrated within Frama-C: any standard Frama-C +options may be used in order to custom the Frama-C execution. Read the Frama-C +User Manual for additional information. + +The list of E-ACSL option is available through the option -e-acsl-help: +$ frama-c -e-acsl-help + +These options are the following. +-e-acsl generate a new project where E-ACSL annotations are + translated to executable C code +-e-acsl-check only type check E-ACSL annotated program +-e-acsl-project <prj> the name of the generated project is <prj> (default to + "e-acsl") + +-e-acsl-help help of plug-in E-ACSL +-e-acsl-h alias for option -e-acsl-help +-e-acsl-version version of plug-in E-ACSL + +-e-acsl-debug <n> level of debug for plug-in E-ACSL (defaults to 0) +-e-acsl-verbose <n> level of verbosity for plug-in E-ACSL (defaults to 1) + +The generated code contains fresh variable names prefixed by 'e_acsl'. No +verification is done to ensure that these new names do not clash with existing +ones. Thus be sure that your input program does not contain any variable +prefixed by 'e_acsl'. A direct consequence is that it is not possible to give as +input to the E-ACSL plug-in a program generated by E-ACSL itself. + +=============================================================================== + COMPATIBILITY WITH PREVIOUS RELEASES +=============================================================================== + +Changes are documented in a textual way in file Changelog. + +=============================================================================== + HAVE FUN WITH E-ACSL! +=============================================================================== diff --git a/src/plugins/e-acsl/TODO b/src/plugins/e-acsl/TODO index 2b21ec90db90f72fa133520544e99806d11d8736..39b22be0af05039dda8c8cf1c7b9682a58630b70 100644 --- a/src/plugins/e-acsl/TODO +++ b/src/plugins/e-acsl/TODO @@ -2,50 +2,25 @@ # NEXT RELEASE # ################ -- quantifications sur les entiers -- mixed assumes and ensures in contracts -- utiliser Options.use_asserts +- vérifier le code de la division et du modulo + (div et modulo mathématiques différents des div et modulo de l'ANSI C99) +- voir les ??? dans le INSTALL et le README ######## # CODE # ######## +- grep TODO *.ml* - Env.new_var*: ajouter la varinfo en sortie de la fonction ? -- function contracts for functions only declared - ==> le noyau génère un "assigns \nothing" pour ces fonctions... - ce assign n'est de toute façon pas gérer -- multi ensures or multi requirements, their conjunctions and undefinedness - [JS 2011/12/06] c'est quoi çà ? :-( - gestion des initialiseurs des globals: requiert un main - mkcall ne devrait pas générer de nouvelles variables pour une même fonction -- garde pour les casts quand overflows potentiels - (même pas de warnings aujourd'hui) -- constante entière longue: utiliser la représentation sous forme de string et - rechercher la base appropriée. -- arithmetic overflows -- [Bernard] avoir une fonction - e_acsl_assert(int guard, char *msg, char *kind) { - if (guard) e_acsl_fail(msg, kind); - } -à appeler au lieu de générer la garde. La kind est le type de l'annotation -(assert, requires, ensures, RTE? ...) -- [Bernard] avoir une fonction - e_acsl_trace_behavior(char *bhv_name) {} -à appeler dès qu'un behavior est activé -- meilleur schéma de compilation des assumes (not possible in multi-bhv?): - if (assume_bhv) { - e_acsl_trace_behavior(bhv_name); - requires_bhv; - run_function; - ensures_bhv; - } -- utiliser Rte (get_rte_annotations dans Oxygen) +- [Bernard] avoir une fonction e_acsl_trace_behavior(char *bhv_name) {} + à appeler dès qu'un behavior est activé +- utiliser Rte pour tous les overflows potentiels + (get_rte_annotations dans Oxygen) - [Yannick] Logic functions -- type system for generating C int/float when possible - (generalisation of current Visit.principal_type, - nouvelle unité de compilation Typing) -- vérifier le code de la division et du modulo - (div et modulo mathématiques différents des div et modulo de l'ANSI C99) +- type system for generating C types whenever possible + (generalisation of current Visit.principal_type) - customization des noms de variable générés (par ex pour indiquer le nom de la variable d'origine, ou son rôle) @@ -60,17 +35,8 @@ # TESTS # ######### -- fonction sans code -- tester plusieurs fonctions contenant des annotations - améliorer test "integer_constant.i" quand bug fixed #745 - test sizeof.i devraient être plus précis quand logic_typing plus précis - structs - unions - inclure exemple du E-ACSL Reference Manual - -#################### -# AVANT LA DISTRIB # -#################### - -- user manual -- make distrib diff --git a/src/plugins/e-acsl/VERSION b/src/plugins/e-acsl/VERSION new file mode 100644 index 0000000000000000000000000000000000000000..49d59571fbf6e077eece30f8c418b6aad15e20b0 --- /dev/null +++ b/src/plugins/e-acsl/VERSION @@ -0,0 +1 @@ +0.1 diff --git a/src/plugins/e-acsl/configure.ac b/src/plugins/e-acsl/configure.ac index ee28fd5882d3bca9ebb235770d155ab21c0b0887..cbed79779ab5e740f710d9204145852d6e947b17 100644 --- a/src/plugins/e-acsl/configure.ac +++ b/src/plugins/e-acsl/configure.ac @@ -1,8 +1,8 @@ ########################################################################## # # -# This file is part of the E-ACSL plug-in of Frama-C. # +# This file is part of the Frama-C's E-ACSL plug-in. # # # -# Copyright (C) 2011 # +# Copyright (C) 2012 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -38,11 +38,36 @@ m4_ifndef([FRAMAC_M4_MACROS], [m4_include(FRAMAC_SHARE/configure.ac)]) check_plugin(e_acsl,PLUGIN_RELATIVE_PATH(plugin_file), [support for E-ACSL plug-in],yes,yes) +# Check Frama-C version +####################### + +AC_MSG_CHECKING(for Frama-C version) + +FRAMAC_VERSION=`frama-c -version | sed -e 's/Version: \(.*\)/\1/' -e '2,$d' ` +AC_MSG_RESULT($FRAMAC_VERSION) + +DEV_VERSION_NUMBER=`echo $FRAMAC_VERSION | sed -e 's/.*-\(.*\)/\1/' ` +VERSION_NUMBER=`echo $DEV_VERSION_NUMBER | sed -e 's/\(.*\)+dev/\1/' ` + +# at the time being, using the Frama-C development version is ok +# DEV=`echo $DEV_VERSION_NUMBER | sed -e 's/.*\(+dev\)/\1/' ` + +if test $VERSION_NUMBER -lt 20111001; then + AC_MSG_ERROR(Frama-C version must be Nitrogen-20111001.) +else if test $VERSION_NUMBER -gt 20111001; then + AC_MSG_WARN(Frama-C version higher than Nitrogen-20111001 not tested: use it at your own risk.) +fi +fi + +# OCaml version +############### + +OCAMLVERSION=`ocamlc -v | sed -n -e 's|.*version *\(.*\)$|\1|p' ` + ############################### # C specific stuff for E-ACSL # ############################### -MAY_USE_ASSERT=true MAY_RUN_TESTS=yes # C compiler and stdio.h @@ -62,17 +87,6 @@ if test -z $HAVE_STDIO_H; then AC_MSG_WARN([stdio.h missing: non-regression tests unavailable.]) fi -# assert.h -########## - -AC_CHECK_HEADER(assert.h,HAVE_ASSERT_H=yes,) - -if test -z $HAVE_ASSERT_H; then - MAY_USE_ASSERT=false - MAY_RUN_TESTS=no - AC_MSG_WARN([assert.h missing: cannot use E-ACSL option -e-acsl-use-assert.]) -fi - # GMP library ############# @@ -89,9 +103,7 @@ fi # testing $CC # Generating Makefile # ####################### -AC_SUBST(MAY_COMPILE_WITH_CC) -AC_SUBST(MAY_USE_ASSERT) AC_SUBST(MAY_RUN_TESTS) -AC_SUBST(GMPSRC_DIR) +AC_SUBST(OCAMLVERSION) write_plugin_config(Makefile) diff --git a/src/plugins/e-acsl/env.ml b/src/plugins/e-acsl/env.ml index 79e4f7e58653bc18601b41fd1bd7f75fed04ae0d..c441c34ef76c1a8104331ecdb31253dcff729f27 100644 --- a/src/plugins/e-acsl/env.ml +++ b/src/plugins/e-acsl/env.ml @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -44,6 +44,7 @@ type local_env = { block_info: block_info; mpz_tbl: mpz_tbl } type t = { visitor: Visitor.frama_c_visitor; + annotation_kind: Misc.annotation_kind; new_global_vars: varinfo list; (* generated variables at function level *) global_mpz_tbl: mpz_tbl; env_stack: local_env list; @@ -64,6 +65,7 @@ let dummy = new Visitor.generic_frama_c_visitor Project_skeleton.dummy (inplace_visit ()); + annotation_kind = Misc.Assertion; new_global_vars = []; global_mpz_tbl = empty_mpz_tbl; env_stack = []; @@ -72,6 +74,7 @@ let dummy = let empty v = { visitor = v; + annotation_kind = Misc.Assertion; new_global_vars = []; global_mpz_tbl = empty_mpz_tbl; env_stack = []; @@ -291,6 +294,9 @@ let stmt_of_label env = function with Kernel_function.No_Statement -> assert false) | LogicLabel(_, _label) -> assert false +let annotation_kind env = env.annotation_kind +let set_annotation_kind env k = { env with annotation_kind = k } + (* Local Variables: compile-command: "make" diff --git a/src/plugins/e-acsl/env.mli b/src/plugins/e-acsl/env.mli index 55865e61ead54017d01f45e4c88c43c24a9d9587..a812d74ada5833399adbb3559588902d292ba665 100644 --- a/src/plugins/e-acsl/env.mli +++ b/src/plugins/e-acsl/env.mli @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -93,6 +93,13 @@ val get_visitor: t -> Visitor.generic_frama_c_visitor val stmt_of_label: t -> logic_label -> stmt +(* ************************************************************************** *) +(** {2 Current annotation kind} *) +(* ************************************************************************** *) + +val annotation_kind: t -> Misc.annotation_kind +val set_annotation_kind: t -> Misc.annotation_kind -> t + (* Local Variables: compile-command: "make" diff --git a/src/plugins/e-acsl/error.ml b/src/plugins/e-acsl/error.ml index dddcbfef537b8e54bc468be40e3661b655c4e481..277cd2222edef1cc14b3f61b96b01277a6b3139c 100644 --- a/src/plugins/e-acsl/error.ml +++ b/src/plugins/e-acsl/error.ml @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/e-acsl/error.mli b/src/plugins/e-acsl/error.mli index c80ae7849a83388e079ddcc2c02d3c4cdc46dcb7..965f64246cb092e05d0655ce9b62c544ee3ab9b7 100644 --- a/src/plugins/e-acsl/error.mli +++ b/src/plugins/e-acsl/error.mli @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -23,13 +23,14 @@ (** Handling errors. *) val untypable: string -> 'a -(** type error built from the given argument. *) +(** Type error built from the given argument. *) val not_yet: string -> 'a -(** not_yet_implemented error built from the given argument. *) +(** Not_yet_implemented error built from the given argument. *) val handle: ('a -> 'a) -> 'a -> 'a -(** run the closure with the given argument and handle potential errors. *) +(** Run the closure with the given argument and handle potential errors. + Return the provide argument in case of errors. *) val nb_untypable: unit -> int (** Number of untypable annotations. *) diff --git a/src/plugins/e-acsl/license/CEA_LGPL b/src/plugins/e-acsl/license/CEA_LGPL index 7eeffb7c0c61a04c93b0b58c7b322df3f31edc8e..2112ea4840d081a364b45ccf635092e4b7594175 100644 --- a/src/plugins/e-acsl/license/CEA_LGPL +++ b/src/plugins/e-acsl/license/CEA_LGPL @@ -1,7 +1,7 @@ -This file is part of the E-ACSL plug-in of Frama-C. +This file is part of the Frama-C's E-ACSL plug-in. -Copyright (C) 2011 +Copyright (C) 2012 CEA (Commissariat à l'énergie atomique et aux énergies alternatives) diff --git a/src/plugins/e-acsl/local_config.mli b/src/plugins/e-acsl/local_config.mli index 9219f5d0ec8b95eff00b3866c642ee3ae66127e2..7a43c1151c0e2fbcb353111b3eaa41f4b3acacb9 100644 --- a/src/plugins/e-acsl/local_config.mli +++ b/src/plugins/e-acsl/local_config.mli @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,7 +20,7 @@ (* *) (**************************************************************************) -val may_use_assert: bool +val version: string (* Local Variables: diff --git a/src/plugins/e-acsl/main.ml b/src/plugins/e-acsl/main.ml index 5a5e829aabb46e6dc844ee4664116d69a86a4cb8..eb9279c444f4887875a4d8c6107cba64e4283733 100644 --- a/src/plugins/e-acsl/main.ml +++ b/src/plugins/e-acsl/main.ml @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -51,7 +51,7 @@ module Resulting_projects = let name = "E-ACSL resulting projects" let size = 7 let kind = `Correctness - let dependencies = [ Ast.self; Options.Use_assert.self ] + let dependencies = [ Ast.self ] end) let () = Env.global_state := Resulting_projects.self diff --git a/src/plugins/e-acsl/misc.ml b/src/plugins/e-acsl/misc.ml index d0a067d8a205fa1825609ded11f519f2e26589b3..719707304b160f506ce197b5af31eb5009f6c7f2 100644 --- a/src/plugins/e-acsl/misc.ml +++ b/src/plugins/e-acsl/misc.ml @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -40,16 +40,30 @@ let mk_call ?(loc=Location.unknown) ?result fname args = let f = new_lval ~loc (makeGlobalVar fname ty) in mkStmt ~valid_sid:true (Instr(Call(result, f, args, loc))) +type annotation_kind = Assertion | Precondition | Postcondition | Invariant + +let kind_to_string loc k = + mkString + ~loc + (match k with + | Assertion -> "Assertion" + | Precondition -> "Precondition" + | Postcondition -> "Postcondition" + | Invariant -> "Invariant") + (* Build a C conditional doing a runtime assertion check. *) -let mk_e_acsl_guard ?(reverse=false) e p = +let mk_e_acsl_guard ?(reverse=false) kind e p = let loc = p.loc in - let unicode = Kernel.Unicode.get () in - Kernel.Unicode.off (); - let msg = Pretty_utils.sfprintf "%a@?" Cil.d_predicate_named p in - Kernel.Unicode.set unicode; - let s = mk_call ~loc "e_acsl_fail" [ mkString loc msg ] in + let msg = + Kernel.Unicode.without_unicode + (Pretty_utils.sfprintf "%a@?" Cil.d_predicate_named) p + in + let line = (fst loc).Lexing.pos_lnum in let e = if reverse then new_exp ~loc:e.eloc (UnOp(LNot, e, intType)) else e in - mkStmt ~valid_sid:true (If(e, mkBlock [ s ], mkBlock [], loc)) + mk_call + ~loc + "e_acsl_assert" + [ e; kind_to_string loc kind; mkString loc msg; Cil.integer loc line ] (* Local Variables: diff --git a/src/plugins/e-acsl/misc.mli b/src/plugins/e-acsl/misc.mli index 4af901ca135cf59b2b60fce1f53cca8f727a87f9..339eae8b4e7dda3d786cb59f964a21c7b6c37c08 100644 --- a/src/plugins/e-acsl/misc.mli +++ b/src/plugins/e-acsl/misc.mli @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -34,7 +34,11 @@ val new_lval: ?loc:Location.t -> varinfo -> exp val mk_call: ?loc:Location.t -> ?result:lval -> string -> exp list -> stmt -val mk_e_acsl_guard: ?reverse:bool -> exp -> predicate named -> stmt +type annotation_kind = Assertion | Precondition | Postcondition | Invariant + +val mk_e_acsl_guard: + ?reverse:bool -> annotation_kind -> exp -> predicate named -> stmt + val e_acsl_header: unit -> global (* diff --git a/src/plugins/e-acsl/mpz.ml b/src/plugins/e-acsl/mpz.ml index 68bdfa58b23d1533464d0c67cb8c37c2c8cfc90c..4be4b0cc65ae70a2cbd41e1df484e7741e331c75 100644 --- a/src/plugins/e-acsl/mpz.ml +++ b/src/plugins/e-acsl/mpz.ml @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/e-acsl/mpz.mli b/src/plugins/e-acsl/mpz.mli index beed2b87abd63e3de5ca09ef955cd1ac68526347..9082e10a895e7b18f03f16902c7c90c43e3721da 100644 --- a/src/plugins/e-acsl/mpz.mli +++ b/src/plugins/e-acsl/mpz.mli @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/e-acsl/options.ml b/src/plugins/e-acsl/options.ml index 0a1c37de2582967cda8353a6136ab82a1a8bf82c..907c16b638ac778f8bcc12f57cc6dce1d4c3a1c3 100644 --- a/src/plugins/e-acsl/options.ml +++ b/src/plugins/e-acsl/options.ml @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -58,15 +58,27 @@ module Project_name = let arg_name = "prj" end) -module Use_assert = +let () = Plugin.set_group help +module Version = False (struct - let option_name = "-e-acsl-use-assert" - let help = "use C macro `assert' instead of `exit' in the new project \ -(by default, use it whenever possible)" - let kind = `Correctness + let option_name = "-e-acsl-version" + let help = "version of plug-in E-ACSL" + let kind = `Tuning end) +let version () = + if Version.get () then begin + Log.print_on_output + (fun fmt -> + Format.fprintf + fmt + "Version of plug-in E-ACSL: %s@?" + Local_config.version); + raise Cmdline.Exit + end +let () = Cmdline.run_after_configuring_stage version + (* Local Variables: compile-command: "make" diff --git a/src/plugins/e-acsl/options.mli b/src/plugins/e-acsl/options.mli index c10b046d2a702bc16e34ff9ab890443560de1814..0ba103bc28f5ce55d297ac06958f0acfb29f993d 100644 --- a/src/plugins/e-acsl/options.mli +++ b/src/plugins/e-acsl/options.mli @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -28,8 +28,6 @@ module Check: Bool module Run: Bool module Project_name: String -module Use_assert: Bool - (* Local Variables: compile-command: "make" diff --git a/src/plugins/e-acsl/quantif.ml b/src/plugins/e-acsl/quantif.ml index b78a919472fbd9851b443054f36d148a5b2d215f..f50d0132f6502319f3c293d11458d44b409c2b73 100644 --- a/src/plugins/e-acsl/quantif.ml +++ b/src/plugins/e-acsl/quantif.ml @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -85,7 +85,15 @@ let compute_quantif_guards quantif bounded_vars hyps = module Label_ids = State_builder.Counter(struct let name = "E_ACSL.Label_ids" end) -let convert env loc p bounded_vars hyps goal = +let convert env loc is_forall p bounded_vars hyps goal = + (* part depending on the kind of quantifications + (either universal or existential) *) + let init_val, found_val, mk_guard = + let z = zero ~loc in + let o = one ~loc in + if is_forall then o, z, (fun x -> x) + else z, o, (fun e -> new_exp ~loc:e.eloc (UnOp(LNot, e, intType))) + in let named_predicate_to_exp = !named_predicate_to_exp_ref in let term_to_exp = !term_to_exp_ref in (* universal quantification over integers (or a subtype of integer) *) @@ -98,7 +106,7 @@ let convert env loc p bounded_vars hyps goal = (fun v _ -> var_res := v; let lv = var v in - [ mkStmtOneInstr ~valid_sid:true (Set(lv, one ~loc, loc)) ]) + [ mkStmtOneInstr ~valid_sid:true (Set(lv, init_val, loc)) ]) in let end_loop_ref = ref dummyStmt in let rec mk_for_loop env = function @@ -112,13 +120,14 @@ let convert env loc p bounded_vars hyps goal = multiple binders (leading to imbricated loops) *) mkBlock [ mkStmtOneInstr - ~valid_sid:true (Set(var !var_res, zero ~loc, loc)); + ~valid_sid:true (Set(var !var_res, found_val, loc)); mkStmt ~valid_sid:true (Goto(end_loop_ref, loc)) ] in let blk, env = Env.pop_and_get env - (mkStmt ~valid_sid:true (If(test, then_block, else_block, loc))) + (mkStmt ~valid_sid:true + (If(mk_guard test, then_block, else_block, loc))) ~global_clear:false Env.After in @@ -126,7 +135,6 @@ let convert env loc p bounded_vars hyps goal = stmts *) [ mkStmt ~valid_sid:true (Block blk) ], env | (t1, rel1, logic_x, rel2, t2) :: tl -> - let body, env = mk_for_loop env tl in let t_plus_one t = Logic_const.term ~loc (TBinOp(PlusA, t, Logic_const.tinteger ~loc ~ikind:IChar 1)) @@ -160,6 +168,8 @@ let convert env loc p bounded_vars hyps goal = Env.add_stmt env (Mpz.init x) | Ctype _ | Ltype _ | Lvar _ | Lreal | Larrow _ -> assert false in + (* build the inner loops and loop body *) + let body, env = mk_for_loop env tl in (* initialize the loop counter to [t1] *) let e1, env = term_to_exp (Env.push env) ty t1 in let init_blk, env = @@ -226,6 +236,17 @@ let convert env loc p bounded_vars hyps goal = let env = List.fold_left Env.Logic_binding.remove env bounded_vars in res, env +let quantif_to_exp env p = + let loc = p.loc in + match p.content with + | Pforall(bounded_vars, { content = Pimplies(hyps, goal) }) -> + convert env loc true p bounded_vars hyps goal + | Pforall _ -> Error.not_yet "unguarded \\forall quantification" + | Pexists(bounded_vars, { content = Pand(hyps, goal) }) -> + convert env loc false p bounded_vars hyps goal + | Pexists _ -> Error.not_yet "unguarded \\exists quantification" + | _ -> assert false + (* Local Variables: compile-command: "make" diff --git a/src/plugins/e-acsl/quantif.mli b/src/plugins/e-acsl/quantif.mli index 0c0361abb432bd4cfb7637f21b90ce4f73ad9e2e..9145fc6262bc53cd0ce4a4774627871cff4f7ea9 100644 --- a/src/plugins/e-acsl/quantif.mli +++ b/src/plugins/e-acsl/quantif.mli @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,16 +20,16 @@ (* *) (**************************************************************************) +(** Convert quantifiers. *) + open Cil_types -val convert: - Env.t -> - location -> - predicate named -> - logic_var list -> - predicate named -> - predicate named -> - exp * Env.t +val quantif_to_exp: Env.t -> predicate named -> exp * Env.t +(** The given predicate must be a quantification. *) + +(* ***********************************************************************) +(** {2 Forward references} *) +(* ***********************************************************************) val named_predicate_to_exp_ref: (Env.t -> predicate named -> exp * Env.t) ref val term_to_exp_ref: (Env.t -> logic_type -> term -> exp * Env.t) ref diff --git a/src/plugins/e-acsl/read_header.ml b/src/plugins/e-acsl/read_header.ml index 4cbf8ebc4171a47c63c6673c99a8444791035eb3..369c5d481b70ea9830a65c0dc9504a2079cee7ad 100644 --- a/src/plugins/e-acsl/read_header.ml +++ b/src/plugins/e-acsl/read_header.ml @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -21,21 +21,21 @@ (**************************************************************************) let put_file_in_buffer fname buf = - try - let cin = - open_in - (Filename.concat Config.datadir (Filename.concat "e-acsl" fname)) - in - try - while true do - let l = input_line cin in - Buffer.add_string buf l; - Buffer.add_char buf '\n'; - done - with End_of_file -> - close_in cin - with Sys_error s -> - Options.abort "cannot read file `%s': %s" fname s + try + let cin = + open_in + (Filename.concat Config.datadir (Filename.concat "e-acsl" fname)) + in + try + while true do + let l = input_line cin in + Buffer.add_string buf l; + Buffer.add_char buf '\n'; + done + with End_of_file -> + close_in cin + with Sys_error s -> + Options.abort "cannot read file `%s': %s" fname s (* TODO: must be project-compliant. The memoized buffer should be reset when we have to redo the visitor in a different setting. *) diff --git a/src/plugins/e-acsl/read_header.mli b/src/plugins/e-acsl/read_header.mli index cafb50d446d600417a1064a0f71af4813c53de4a..5f096cd4e8167e688a293070e834f3b3d45d57a3 100644 --- a/src/plugins/e-acsl/read_header.mli +++ b/src/plugins/e-acsl/read_header.mli @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/e-acsl/share/e-acsl/e_acsl.h b/src/plugins/e-acsl/share/e-acsl/e_acsl.h index e6aad32de873b0fb8f7a27b1505ef940ad9cd017..76c024ea13f57f3c2b55e7ae6e2768677d6fc08b 100644 --- a/src/plugins/e-acsl/share/e-acsl/e_acsl.h +++ b/src/plugins/e-acsl/share/e-acsl/e_acsl.h @@ -1,8 +1,8 @@ /**************************************************************************/ /* */ -/* This file is part of the E-ACSL plug-in of Frama-C. */ +/* This file is part of the Frama-C's E-ACSL plug-in. */ /* */ -/* Copyright (C) 2011 */ +/* Copyright (C) 2012 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -20,16 +20,6 @@ /* */ /**************************************************************************/ -// TODO: remplacer par un e_acsl.h.in -// faire générer par le makefile un e_acsl.h -// avec des #include "FRAMAC_SHARE/libc/stdio.h", etc - -// [TODO] ne pas générer les typedef si on veut linker avec GMP derrière - -// [TODO] utiliser un champ modèle de type integer pour modéliser -// l'entier exact correspondant à un mpz_t. -// Not yet implemented in ACSL. - /************************/ /* Standard C functions */ /************************/ @@ -46,4 +36,10 @@ extern int printf(const char *, ...); /* Dedicated E-ACSL function */ /*****************************/ -void e_acsl_fail(char *msg) { printf("%s\n", msg); exit(1); } +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n", + kind, line, pred_txt); + exit(1); + } +} diff --git a/src/plugins/e-acsl/share/e-acsl/e_acsl_gmp.h b/src/plugins/e-acsl/share/e-acsl/e_acsl_gmp.h index fd3290860b2e460b2f30876d3acf5fc7f42227f6..c2a27a32c6a69e6a2fe7c793ed4ea1914a2e40ca 100644 --- a/src/plugins/e-acsl/share/e-acsl/e_acsl_gmp.h +++ b/src/plugins/e-acsl/share/e-acsl/e_acsl_gmp.h @@ -1,8 +1,8 @@ /**************************************************************************/ /* */ -/* This file is part of the E-ACSL plug-in of Frama-C. */ +/* This file is part of the Frama-C's E-ACSL plug-in. */ /* */ -/* Copyright (C) 2011 */ +/* Copyright (C) 2012 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/src/plugins/e-acsl/share/e-acsl/e_acsl_gmp_types.h b/src/plugins/e-acsl/share/e-acsl/e_acsl_gmp_types.h index 30a1547b8f033aff55f730a7d1b3b7a798f37f13..f1609a00da56909e456c26f3cd09ab1d8f1a3a0d 100644 --- a/src/plugins/e-acsl/share/e-acsl/e_acsl_gmp_types.h +++ b/src/plugins/e-acsl/share/e-acsl/e_acsl_gmp_types.h @@ -1,8 +1,8 @@ /**************************************************************************/ /* */ -/* This file is part of the E-ACSL plug-in of Frama-C. */ +/* This file is part of the Frama-C's E-ACSL plug-in. */ /* */ -/* Copyright (C) 2011 */ +/* Copyright (C) 2012 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -24,6 +24,10 @@ /* GMP types */ /*************/ +// [TODO] utiliser un champ modèle de type integer pour modéliser +// l'entier exact correspondant à un mpz_t. +// Not yet implemented in ACSL. + typedef struct { int _mp_alloc; int _mp_size; diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/function_contract.i b/src/plugins/e-acsl/tests/e-acsl-runtime/function_contract.i index df73c710ff097143d5a756d080d40d01118bee6b..95facef562c624c29ff647f142f945aff42e3e56 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/function_contract.i +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/function_contract.i @@ -51,6 +51,17 @@ int l() { return X; } +// mix ensures and assumes +/*@ behavior b1: + @ assumes X == 7; + @ ensures X == 95; + @ behavior b2: + @ assumes X == 5; + @ assumes Y == 2; + @ ensures X == 7; + @ ensures X == \old(X) + Y; */ +void m(void) { X += Y; } + int main(void) { f(); g(); @@ -59,5 +70,6 @@ int main(void) { j(); k(); l(); + m(); return 0; } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/invariant.i b/src/plugins/e-acsl/tests/e-acsl-runtime/invariant.i new file mode 100644 index 0000000000000000000000000000000000000000..fc2865a7e3dbfa9e9ecff8fc88eb48009d98ac42 --- /dev/null +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/invariant.i @@ -0,0 +1,13 @@ +/* run.config + COMMENT: invariant + EXECNOW: LOG gen_invariant.c BIN gen_invariant.out FRAMAC_SHARE=./share @frama-c@ ./tests/e-acsl-runtime/invariant.i -e-acsl -then-on e-acsl -print -ocode ./tests/e-acsl-runtime/result/gen_invariant.c > /dev/null && gcc -pedantic -o ./tests/e-acsl-runtime/result/gen_invariant.out ./tests/e-acsl-runtime/result/gen_invariant.c -lgmp && ./tests/e-acsl-runtime/result/gen_invariant.out +*/ +int main(void) { + int x = 0; + for(int i = 0; i < 10; i++) { + /*@ invariant 0 <= i < 10; */ + x += i; + /*@ invariant i <= x; */ + } + return 0; +} diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/lazy.i b/src/plugins/e-acsl/tests/e-acsl-runtime/lazy.i index 2fe2e58ef6238a07215a0f06fea7e2ce0c75aa23..560c3d6686c322da41d3a54cd8d914976c8109a5 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/lazy.i +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/lazy.i @@ -1,15 +1,30 @@ /* run.config - COMMENT: predicate using lazy operators + COMMENT: terms and predicates using lazy operators EXECNOW: LOG gen_lazy.c BIN gen_lazy.out FRAMAC_SHARE=./share @frama-c@ ./tests/e-acsl-runtime/lazy.i -e-acsl -then-on e-acsl -print -ocode ./tests/e-acsl-runtime/result/gen_lazy.c > /dev/null && gcc -pedantic -o ./tests/e-acsl-runtime/result/gen_lazy.out ./tests/e-acsl-runtime/result/gen_lazy.c -lgmp 2> /dev/null && ./tests/e-acsl-runtime/result/gen_lazy.out */ int main(void) { int x = 0, y = 1; + + // lazy predicates /*@ assert x == 0 && y == 1; */ /*@ assert ! (x != 0 && y == 1/0); */ /*@ assert y == 1 || x == 1; */ /*@ assert x == 0 || y == 1/0; */ /*@ assert x == 0 ==> y == 1; */ /*@ assert x == 1 ==> y == 1/0; */ + /*@ assert x ? x : y; */ + /*@ assert y ? y : x; */ + /*@ assert x == 1 ? x == 18 : x == 0; */ + + // these predicates are not lazy, but are encoded by lazy ones + /*@ assert x == 2 <==> y == 3; */ + /*@ assert x == 0 <==> y == 1; */ + + // lazy terms + /*@ assert (x ? x : y) == (x == 0); */ + /*@ assert (x && y) || y; */ + /*@ assert (x || y) && y == 1; */ + return 0; } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/addrOf.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/addrOf.res.oracle index 04ddc6bdc8fc3d7f49b1fd35176b2ec4ce392f85..3f1f22665852cf09976895efc41112547bf25709 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/addrOf.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/addrOf.res.oracle @@ -3,9 +3,14 @@ [value] Initial state computed [value] Values of globals at initialization PROJECT_FILE.i:230:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:231. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} x ∈ {0} @@ -16,10 +21,13 @@ PROJECT_FILE.i:230:[value] Assertion got status valid. extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -29,7 +37,7 @@ int main(void) int x; x = 0; /*@ assert &x ≡ &x; */ ; - if (! (& x == & x)) { e_acsl_fail((char *)"(&x == &x)"); } + e_acsl_assert(! (& x == & x),(char *)"Assertion",(char *)"(&x == &x)",7); __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/arith.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/arith.res.oracle index 8625bcd3fd5284f76d619f2b5f9aa8d74052451c..94904a7292672266600c992ba72702a256c9414a 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/arith.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/arith.res.oracle @@ -6,39 +6,39 @@ PROJECT_FILE.i:232:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:238. -PROJECT_FILE.i:78:[value] Function __gmpz_init_set_si: postcondition got status valid. +PROJECT_FILE.i:82:[value] Function __gmpz_init_set_si: postcondition got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. Called from PROJECT_FILE.i:239. -PROJECT_FILE.i:65:[value] Function __gmpz_init: postcondition got status valid. +PROJECT_FILE.i:69:[value] Function __gmpz_init: postcondition got status valid. [value] Done for function __gmpz_init [value] computing for function __gmpz_neg <- main. Called from PROJECT_FILE.i:240. -PROJECT_FILE.i:129:[value] Function __gmpz_neg: precondition got status valid. -PROJECT_FILE.i:130:[value] Function __gmpz_neg: precondition got status valid. +PROJECT_FILE.i:133:[value] Function __gmpz_neg: precondition got status valid. +PROJECT_FILE.i:134:[value] Function __gmpz_neg: precondition got status valid. [value] Done for function __gmpz_neg [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:241. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:242. -PROJECT_FILE.i:115:[value] Function __gmpz_cmp: precondition got status valid. -PROJECT_FILE.i:116:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:119:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:120:[value] Function __gmpz_cmp: precondition got status valid. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:243. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:244. -PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:245. @@ -62,16 +62,16 @@ PROJECT_FILE.i:250:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:260. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:261. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:262. [value] Done for function __gmpz_clear @@ -95,16 +95,16 @@ PROJECT_FILE.i:268:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:276. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:277. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:278. [value] Done for function __gmpz_clear @@ -123,9 +123,9 @@ PROJECT_FILE.i:283:[value] Assertion got status valid. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. Called from PROJECT_FILE.i:294. -PROJECT_FILE.i:134:[value] Function __gmpz_add: precondition got status valid. -PROJECT_FILE.i:135:[value] Function __gmpz_add: precondition got status valid. -PROJECT_FILE.i:136:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:138:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:139:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:140:[value] Function __gmpz_add: precondition got status valid. [value] Done for function __gmpz_add [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:295. @@ -139,16 +139,16 @@ PROJECT_FILE.i:136:[value] Function __gmpz_add: precondition got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:298. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:299. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:300. [value] Done for function __gmpz_clear @@ -176,9 +176,9 @@ PROJECT_FILE.i:308:[value] Assertion got status valid. [value] Done for function __gmpz_init [value] computing for function __gmpz_sub <- main. Called from PROJECT_FILE.i:319. -PROJECT_FILE.i:140:[value] Function __gmpz_sub: precondition got status valid. -PROJECT_FILE.i:141:[value] Function __gmpz_sub: precondition got status valid. -PROJECT_FILE.i:142:[value] Function __gmpz_sub: precondition got status valid. +PROJECT_FILE.i:144:[value] Function __gmpz_sub: precondition got status valid. +PROJECT_FILE.i:145:[value] Function __gmpz_sub: precondition got status valid. +PROJECT_FILE.i:146:[value] Function __gmpz_sub: precondition got status valid. [value] Done for function __gmpz_sub [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:320. @@ -192,16 +192,16 @@ PROJECT_FILE.i:142:[value] Function __gmpz_sub: precondition got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:323. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:324. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:325. [value] Done for function __gmpz_clear @@ -229,9 +229,9 @@ PROJECT_FILE.i:333:[value] Assertion got status valid. [value] Done for function __gmpz_init [value] computing for function __gmpz_mul <- main. Called from PROJECT_FILE.i:344. -PROJECT_FILE.i:146:[value] Function __gmpz_mul: precondition got status valid. -PROJECT_FILE.i:147:[value] Function __gmpz_mul: precondition got status valid. -PROJECT_FILE.i:148:[value] Function __gmpz_mul: precondition got status valid. +PROJECT_FILE.i:150:[value] Function __gmpz_mul: precondition got status valid. +PROJECT_FILE.i:151:[value] Function __gmpz_mul: precondition got status valid. +PROJECT_FILE.i:152:[value] Function __gmpz_mul: precondition got status valid. [value] Done for function __gmpz_mul [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:345. @@ -245,16 +245,16 @@ PROJECT_FILE.i:148:[value] Function __gmpz_mul: precondition got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:348. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:349. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:350. [value] Done for function __gmpz_clear @@ -279,27 +279,27 @@ PROJECT_FILE.i:358:[value] Assertion got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_get_si <- main. Called from PROJECT_FILE.i:369. -PROJECT_FILE.i:168:[value] Function __gmpz_get_si: precondition got status valid. +PROJECT_FILE.i:172:[value] Function __gmpz_get_si: precondition got status valid. [value] Done for function __gmpz_get_si [value] computing for function __gmpz_init <- main. Called from PROJECT_FILE.i:370. [value] Done for function __gmpz_init PROJECT_FILE.i:371:[value] Assertion got status valid. -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:372. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_tdiv_q <- main. Called from PROJECT_FILE.i:373. -PROJECT_FILE.i:152:[value] Function __gmpz_tdiv_q: precondition got status valid. -PROJECT_FILE.i:153:[value] Function __gmpz_tdiv_q: precondition got status valid. -PROJECT_FILE.i:154:[value] Function __gmpz_tdiv_q: precondition got status valid. +PROJECT_FILE.i:156:[value] Function __gmpz_tdiv_q: precondition got status valid. +PROJECT_FILE.i:157:[value] Function __gmpz_tdiv_q: precondition got status valid. +PROJECT_FILE.i:158:[value] Function __gmpz_tdiv_q: precondition got status valid. [value] Done for function __gmpz_tdiv_q [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:374. @@ -313,16 +313,16 @@ PROJECT_FILE.i:154:[value] Function __gmpz_tdiv_q: precondition got status valid [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:377. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:378. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:379. [value] Done for function __gmpz_clear @@ -341,7 +341,7 @@ PROJECT_FILE.i:154:[value] Function __gmpz_tdiv_q: precondition got status valid PROJECT_FILE.i:387:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_str <- main. Called from PROJECT_FILE.i:395. -PROJECT_FILE.i:82:[value] Function __gmpz_init_set_str: postcondition got status valid. +PROJECT_FILE.i:86:[value] Function __gmpz_init_set_str: postcondition got status valid. [value] Done for function __gmpz_init_set_str [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:396. @@ -353,16 +353,16 @@ PROJECT_FILE.i:82:[value] Function __gmpz_init_set_str: postcondition got status Called from PROJECT_FILE.i:398. [value] Done for function __gmpz_init PROJECT_FILE.i:399:[value] Assertion got status valid. -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:400. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_tdiv_q <- main. Called from PROJECT_FILE.i:401. [value] Done for function __gmpz_tdiv_q @@ -372,16 +372,19 @@ PROJECT_FILE.i:399:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:403. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:405. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:404. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:406. +[value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:407. [value] Done for function __gmpz_clear @@ -391,61 +394,61 @@ PROJECT_FILE.i:399:[value] Assertion got status valid. [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:409. [value] Done for function __gmpz_clear -[value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:410. -[value] Done for function __gmpz_clear -PROJECT_FILE.i:414:[value] Assertion got status valid. +PROJECT_FILE.i:413:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:423. + Called from PROJECT_FILE.i:422. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:424. + Called from PROJECT_FILE.i:423. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_get_si <- main. - Called from PROJECT_FILE.i:425. + Called from PROJECT_FILE.i:424. [value] Done for function __gmpz_get_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:426. + Called from PROJECT_FILE.i:425. [value] Done for function __gmpz_init -PROJECT_FILE.i:427:[value] Assertion got status valid. -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:428. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +PROJECT_FILE.i:426:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:427. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_tdiv_r <- main. - Called from PROJECT_FILE.i:429. -PROJECT_FILE.i:158:[value] Function __gmpz_tdiv_r: precondition got status valid. -PROJECT_FILE.i:159:[value] Function __gmpz_tdiv_r: precondition got status valid. -PROJECT_FILE.i:160:[value] Function __gmpz_tdiv_r: precondition got status valid. + Called from PROJECT_FILE.i:428. +PROJECT_FILE.i:162:[value] Function __gmpz_tdiv_r: precondition got status valid. +PROJECT_FILE.i:163:[value] Function __gmpz_tdiv_r: precondition got status valid. +PROJECT_FILE.i:164:[value] Function __gmpz_tdiv_r: precondition got status valid. [value] Done for function __gmpz_tdiv_r [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:430. + Called from PROJECT_FILE.i:429. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:431. + Called from PROJECT_FILE.i:430. [value] Done for function __gmpz_init [value] computing for function __gmpz_neg <- main. - Called from PROJECT_FILE.i:432. + Called from PROJECT_FILE.i:431. [value] Done for function __gmpz_neg [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:433. + Called from PROJECT_FILE.i:432. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:434. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:433. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:434. +[value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:435. [value] Done for function __gmpz_clear @@ -458,73 +461,73 @@ PROJECT_FILE.i:160:[value] Function __gmpz_tdiv_r: precondition got status valid [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:438. [value] Done for function __gmpz_clear -[value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:439. -[value] Done for function __gmpz_clear -PROJECT_FILE.i:443:[value] Assertion got status valid. +PROJECT_FILE.i:442:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:455. + Called from PROJECT_FILE.i:454. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:456. + Called from PROJECT_FILE.i:455. [value] Done for function __gmpz_init [value] computing for function __gmpz_neg <- main. - Called from PROJECT_FILE.i:457. + Called from PROJECT_FILE.i:456. [value] Done for function __gmpz_neg [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:458. + Called from PROJECT_FILE.i:457. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:459. + Called from PROJECT_FILE.i:458. [value] Done for function __gmpz_init [value] computing for function __gmpz_neg <- main. - Called from PROJECT_FILE.i:460. + Called from PROJECT_FILE.i:459. [value] Done for function __gmpz_neg [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:461. + Called from PROJECT_FILE.i:460. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:462. + Called from PROJECT_FILE.i:461. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:463. + Called from PROJECT_FILE.i:462. [value] Done for function __gmpz_init -PROJECT_FILE.i:464:[value] Assertion got status valid. -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:465. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +PROJECT_FILE.i:463:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:464. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_tdiv_r <- main. - Called from PROJECT_FILE.i:466. + Called from PROJECT_FILE.i:465. [value] Done for function __gmpz_tdiv_r [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:467. + Called from PROJECT_FILE.i:466. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:468. + Called from PROJECT_FILE.i:467. [value] Done for function __gmpz_init [value] computing for function __gmpz_neg <- main. - Called from PROJECT_FILE.i:469. + Called from PROJECT_FILE.i:468. [value] Done for function __gmpz_neg [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:470. + Called from PROJECT_FILE.i:469. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:471. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:470. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:471. +[value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:472. [value] Done for function __gmpz_clear @@ -546,61 +549,61 @@ PROJECT_FILE.i:464:[value] Assertion got status valid. [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:478. [value] Done for function __gmpz_clear -[value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:479. -[value] Done for function __gmpz_clear -PROJECT_FILE.i:483:[value] Assertion got status valid. +PROJECT_FILE.i:482:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:493. + Called from PROJECT_FILE.i:492. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:494. + Called from PROJECT_FILE.i:493. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:495. + Called from PROJECT_FILE.i:494. [value] Done for function __gmpz_init [value] computing for function __gmpz_neg <- main. - Called from PROJECT_FILE.i:496. + Called from PROJECT_FILE.i:495. [value] Done for function __gmpz_neg [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:497. + Called from PROJECT_FILE.i:496. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:498. + Called from PROJECT_FILE.i:497. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:499. + Called from PROJECT_FILE.i:498. [value] Done for function __gmpz_init -PROJECT_FILE.i:500:[value] Assertion got status valid. -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:501. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +PROJECT_FILE.i:499:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:500. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_tdiv_r <- main. - Called from PROJECT_FILE.i:502. + Called from PROJECT_FILE.i:501. [value] Done for function __gmpz_tdiv_r [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:503. + Called from PROJECT_FILE.i:502. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:504. + Called from PROJECT_FILE.i:503. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:505. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:504. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:505. +[value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:506. [value] Done for function __gmpz_clear @@ -616,83 +619,83 @@ PROJECT_FILE.i:500:[value] Assertion got status valid. [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:510. [value] Done for function __gmpz_clear -[value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:511. -[value] Done for function __gmpz_clear -PROJECT_FILE.i:515:[value] Assertion got status valid. +PROJECT_FILE.i:514:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:531. + Called from PROJECT_FILE.i:530. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:532. + Called from PROJECT_FILE.i:531. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:533. + Called from PROJECT_FILE.i:532. [value] Done for function __gmpz_init [value] computing for function __gmpz_mul <- main. - Called from PROJECT_FILE.i:534. + Called from PROJECT_FILE.i:533. [value] Done for function __gmpz_mul [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:535. + Called from PROJECT_FILE.i:534. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:536. + Called from PROJECT_FILE.i:535. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:537. + Called from PROJECT_FILE.i:536. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:538. + Called from PROJECT_FILE.i:537. [value] Done for function __gmpz_add [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:539. + Called from PROJECT_FILE.i:538. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:540. + Called from PROJECT_FILE.i:539. [value] Done for function __gmpz_add [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:541. + Called from PROJECT_FILE.i:540. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:542. + Called from PROJECT_FILE.i:541. [value] Done for function __gmpz_init [value] computing for function __gmpz_sub <- main. - Called from PROJECT_FILE.i:543. + Called from PROJECT_FILE.i:542. [value] Done for function __gmpz_sub [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:544. + Called from PROJECT_FILE.i:543. [value] Done for function __gmpz_init [value] computing for function __gmpz_sub <- main. - Called from PROJECT_FILE.i:545. + Called from PROJECT_FILE.i:544. [value] Done for function __gmpz_sub [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:546. + Called from PROJECT_FILE.i:545. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:547. + Called from PROJECT_FILE.i:546. [value] Done for function __gmpz_add [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:548. + Called from PROJECT_FILE.i:547. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:549. + Called from PROJECT_FILE.i:548. [value] Done for function __gmpz_init [value] computing for function __gmpz_neg <- main. - Called from PROJECT_FILE.i:550. + Called from PROJECT_FILE.i:549. [value] Done for function __gmpz_neg [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:551. + Called from PROJECT_FILE.i:550. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:552. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:551. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:553. +[value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:554. [value] Done for function __gmpz_clear @@ -729,10 +732,11 @@ PROJECT_FILE.i:515:[value] Assertion got status valid. [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:565. [value] Done for function __gmpz_clear -[value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:566. -[value] Done for function __gmpz_clear -PROJECT_FILE.i:570:[value] Assertion got status valid. +PROJECT_FILE.i:569:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:570. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:573:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:579. @@ -749,16 +753,16 @@ PROJECT_FILE.i:573:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:583. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:584. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:586. [value] Done for function __gmpz_clear @@ -784,32 +788,39 @@ PROJECT_FILE.i:592:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:602. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:604. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:603. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:606. + Called from PROJECT_FILE.i:605. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:607. + Called from PROJECT_FILE.i:606. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:608. + Called from PROJECT_FILE.i:607. [value] Done for function __gmpz_clear -PROJECT_FILE.i:612:[value] Assertion got status valid. +PROJECT_FILE.i:611:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:612. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:615:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:616. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} x ∈ {-3} @@ -895,10 +906,13 @@ extern long __gmpz_get_si(__mpz_struct const * /*[1]*/ z); extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -924,7 +938,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_3),(long)x); e_acsl_4 = __gmpz_cmp((__mpz_struct const *)(e_acsl_2), (__mpz_struct const *)(e_acsl_3)); - if (! (e_acsl_4 == 0)) { e_acsl_fail((char *)"(-3 == x)"); } + e_acsl_assert(! (e_acsl_4 == 0),(char *)"Assertion",(char *)"(-3 == x)", + 11); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); __gmpz_clear((__mpz_struct *)(e_acsl_3)); @@ -942,7 +957,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_7),(__mpz_struct const *)(e_acsl_6)); e_acsl_8 = __gmpz_cmp((__mpz_struct const *)(e_acsl_5), (__mpz_struct const *)(e_acsl_7)); - if (! (e_acsl_8 == 0)) { e_acsl_fail((char *)"(x == -3)"); } + e_acsl_assert(! (e_acsl_8 == 0),(char *)"Assertion",(char *)"(x == -3)", + 12); __gmpz_clear((__mpz_struct *)(e_acsl_5)); __gmpz_clear((__mpz_struct *)(e_acsl_6)); __gmpz_clear((__mpz_struct *)(e_acsl_7)); @@ -958,7 +974,8 @@ int main(void) __gmpz_com(e_acsl_10,e_acsl_9); e_acsl_11 = __gmpz_cmp((__mpz_struct const *)(e_acsl_9), (__mpz_struct const *)(e_acsl_10)); - if (! (e_acsl_11 != 0)) { e_acsl_fail((char *)"(0 != ~0)"); } + e_acsl_assert(! (e_acsl_11 != 0),(char *)"Assertion",(char *)"(0 != ~0)", + 13); __gmpz_clear((__mpz_struct *)(e_acsl_9)); __gmpz_clear((__mpz_struct *)(e_acsl_10)); } @@ -981,7 +998,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_16),(__mpz_struct const *)(e_acsl_15)); e_acsl_17 = __gmpz_cmp((__mpz_struct const *)(e_acsl_14), (__mpz_struct const *)(e_acsl_16)); - if (! (e_acsl_17 == 0)) { e_acsl_fail((char *)"(x+1 == -2)"); } + e_acsl_assert(! (e_acsl_17 == 0),(char *)"Assertion", + (char *)"(x+1 == -2)",15); __gmpz_clear((__mpz_struct *)(e_acsl_12)); __gmpz_clear((__mpz_struct *)(e_acsl_13)); __gmpz_clear((__mpz_struct *)(e_acsl_14)); @@ -1007,7 +1025,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_22),(__mpz_struct const *)(e_acsl_21)); e_acsl_23 = __gmpz_cmp((__mpz_struct const *)(e_acsl_20), (__mpz_struct const *)(e_acsl_22)); - if (! (e_acsl_23 == 0)) { e_acsl_fail((char *)"(x-1 == -4)"); } + e_acsl_assert(! (e_acsl_23 == 0),(char *)"Assertion", + (char *)"(x-1 == -4)",16); __gmpz_clear((__mpz_struct *)(e_acsl_18)); __gmpz_clear((__mpz_struct *)(e_acsl_19)); __gmpz_clear((__mpz_struct *)(e_acsl_20)); @@ -1033,7 +1052,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_28),(__mpz_struct const *)(e_acsl_27)); e_acsl_29 = __gmpz_cmp((__mpz_struct const *)(e_acsl_26), (__mpz_struct const *)(e_acsl_28)); - if (! (e_acsl_29 == 0)) { e_acsl_fail((char *)"(x*3 == -9)"); } + e_acsl_assert(! (e_acsl_29 == 0),(char *)"Assertion", + (char *)"(x*3 == -9)",17); __gmpz_clear((__mpz_struct *)(e_acsl_24)); __gmpz_clear((__mpz_struct *)(e_acsl_25)); __gmpz_clear((__mpz_struct *)(e_acsl_26)); @@ -1055,7 +1075,7 @@ int main(void) e_acsl_32 = (int)__gmpz_get_si((__mpz_struct const *)(e_acsl_31)); __gmpz_init((__mpz_struct *)(e_acsl_33)); /*@ assert 3 ≢ 0; */ ; - if (e_acsl_32 == 0) { e_acsl_fail((char *)"(3 == 0)"); } + e_acsl_assert(e_acsl_32 == 0,(char *)"Assertion",(char *)"(3 == 0)",18); __gmpz_tdiv_q((__mpz_struct *)(e_acsl_33), (__mpz_struct const *)(e_acsl_30), (__mpz_struct const *)(e_acsl_31)); @@ -1064,7 +1084,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_35),(__mpz_struct const *)(e_acsl_34)); e_acsl_36 = __gmpz_cmp((__mpz_struct const *)(e_acsl_33), (__mpz_struct const *)(e_acsl_35)); - if (! (e_acsl_36 == 0)) { e_acsl_fail((char *)"(x/3 == -1)"); } + e_acsl_assert(! (e_acsl_36 == 0),(char *)"Assertion", + (char *)"(x/3 == -1)",18); __gmpz_clear((__mpz_struct *)(e_acsl_30)); __gmpz_clear((__mpz_struct *)(e_acsl_31)); __gmpz_clear((__mpz_struct *)(e_acsl_33)); @@ -1086,16 +1107,16 @@ int main(void) (__mpz_struct const *)(e_acsl_38)); __gmpz_init((__mpz_struct *)(e_acsl_40)); /*@ assert 0xfffffffffff ≢ 0; */ ; - if (e_acsl_39 == 0) { e_acsl_fail((char *)"(0xfffffffffff == 0)"); } + e_acsl_assert(e_acsl_39 == 0,(char *)"Assertion", + (char *)"(0xfffffffffff == 0)",19); __gmpz_tdiv_q((__mpz_struct *)(e_acsl_40), (__mpz_struct const *)(e_acsl_37), (__mpz_struct const *)(e_acsl_37)); __gmpz_init_set_si((__mpz_struct *)(e_acsl_41),(long)1); e_acsl_42 = __gmpz_cmp((__mpz_struct const *)(e_acsl_40), (__mpz_struct const *)(e_acsl_41)); - if (! (e_acsl_42 == 0)) { - e_acsl_fail((char *)"(0xfffffffffff/0xfffffffffff == 1)"); - } + e_acsl_assert(! (e_acsl_42 == 0),(char *)"Assertion", + (char *)"(0xfffffffffff/0xfffffffffff == 1)",19); __gmpz_clear((__mpz_struct *)(e_acsl_37)); __gmpz_clear((__mpz_struct *)(e_acsl_38)); __gmpz_clear((__mpz_struct *)(e_acsl_40)); @@ -1116,7 +1137,7 @@ int main(void) e_acsl_45 = (int)__gmpz_get_si((__mpz_struct const *)(e_acsl_44)); __gmpz_init((__mpz_struct *)(e_acsl_46)); /*@ assert 2 ≢ 0; */ ; - if (e_acsl_45 == 0) { e_acsl_fail((char *)"(2 == 0)"); } + e_acsl_assert(e_acsl_45 == 0,(char *)"Assertion",(char *)"(2 == 0)",20); __gmpz_tdiv_r((__mpz_struct *)(e_acsl_46), (__mpz_struct const *)(e_acsl_43), (__mpz_struct const *)(e_acsl_44)); @@ -1125,7 +1146,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_48),(__mpz_struct const *)(e_acsl_47)); e_acsl_49 = __gmpz_cmp((__mpz_struct const *)(e_acsl_46), (__mpz_struct const *)(e_acsl_48)); - if (! (e_acsl_49 == 0)) { e_acsl_fail((char *)"(x%2 == -1)"); } + e_acsl_assert(! (e_acsl_49 == 0),(char *)"Assertion", + (char *)"(x%2 == -1)",20); __gmpz_clear((__mpz_struct *)(e_acsl_43)); __gmpz_clear((__mpz_struct *)(e_acsl_44)); __gmpz_clear((__mpz_struct *)(e_acsl_46)); @@ -1156,7 +1178,7 @@ int main(void) (__mpz_struct const *)(e_acsl_54)); __gmpz_init((__mpz_struct *)(e_acsl_56)); /*@ assert -2 ≢ 0; */ ; - if (e_acsl_55 == 0) { e_acsl_fail((char *)"(-2 == 0)"); } + e_acsl_assert(e_acsl_55 == 0,(char *)"Assertion",(char *)"(-2 == 0)",21); __gmpz_tdiv_r((__mpz_struct *)(e_acsl_56), (__mpz_struct const *)(e_acsl_51), (__mpz_struct const *)(e_acsl_53)); @@ -1165,7 +1187,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_58),(__mpz_struct const *)(e_acsl_57)); e_acsl_59 = __gmpz_cmp((__mpz_struct const *)(e_acsl_56), (__mpz_struct const *)(e_acsl_58)); - if (! (e_acsl_59 == 0)) { e_acsl_fail((char *)"(-3%-2 == -1)"); } + e_acsl_assert(! (e_acsl_59 == 0),(char *)"Assertion", + (char *)"(-3%-2 == -1)",21); __gmpz_clear((__mpz_struct *)(e_acsl_50)); __gmpz_clear((__mpz_struct *)(e_acsl_51)); __gmpz_clear((__mpz_struct *)(e_acsl_52)); @@ -1195,14 +1218,15 @@ int main(void) (__mpz_struct const *)(e_acsl_63)); __gmpz_init((__mpz_struct *)(e_acsl_65)); /*@ assert -2 ≢ 0; */ ; - if (e_acsl_64 == 0) { e_acsl_fail((char *)"(-2 == 0)"); } + e_acsl_assert(e_acsl_64 == 0,(char *)"Assertion",(char *)"(-2 == 0)",22); __gmpz_tdiv_r((__mpz_struct *)(e_acsl_65), (__mpz_struct const *)(e_acsl_60), (__mpz_struct const *)(e_acsl_62)); __gmpz_init_set_si((__mpz_struct *)(e_acsl_66),(long)1); e_acsl_67 = __gmpz_cmp((__mpz_struct const *)(e_acsl_65), (__mpz_struct const *)(e_acsl_66)); - if (! (e_acsl_67 == 0)) { e_acsl_fail((char *)"(3%-2 == 1)"); } + e_acsl_assert(! (e_acsl_67 == 0),(char *)"Assertion", + (char *)"(3%-2 == 1)",22); __gmpz_clear((__mpz_struct *)(e_acsl_60)); __gmpz_clear((__mpz_struct *)(e_acsl_61)); __gmpz_clear((__mpz_struct *)(e_acsl_62)); @@ -1255,9 +1279,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_80),(__mpz_struct const *)(e_acsl_79)); e_acsl_81 = __gmpz_cmp((__mpz_struct const *)(e_acsl_78), (__mpz_struct const *)(e_acsl_80)); - if (! (e_acsl_81 == 0)) { - e_acsl_fail((char *)"(((x*2+(3+y))-4)+(x-y) == -10)"); - } + e_acsl_assert(! (e_acsl_81 == 0),(char *)"Assertion", + (char *)"(((x*2+(3+y))-4)+(x-y) == -10)",24); __gmpz_clear((__mpz_struct *)(e_acsl_68)); __gmpz_clear((__mpz_struct *)(e_acsl_69)); __gmpz_clear((__mpz_struct *)(e_acsl_70)); @@ -1274,9 +1297,8 @@ int main(void) } /*@ assert (0≡1) ≡ !(0≡0); */ ; - if (! ((0 == 1) == ! (0 == 0))) { - e_acsl_fail((char *)"((0==1) == !(0==0))"); - } + e_acsl_assert(! ((0 == 1) == ! (0 == 0)),(char *)"Assertion", + (char *)"((0==1) == !(0==0))",26); /*@ assert (0≤-1) ≡ (0>0); */ ; { mpz_t e_acsl_82; @@ -1289,9 +1311,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_84),(__mpz_struct const *)(e_acsl_83)); e_acsl_85 = __gmpz_cmp((__mpz_struct const *)(e_acsl_82), (__mpz_struct const *)(e_acsl_84)); - if (! ((e_acsl_85 <= 0) == (0 > 0))) { - e_acsl_fail((char *)"((0<=-1) == (0>0))"); - } + e_acsl_assert(! ((e_acsl_85 <= 0) == (0 > 0)),(char *)"Assertion", + (char *)"((0<=-1) == (0>0))",27); __gmpz_clear((__mpz_struct *)(e_acsl_82)); __gmpz_clear((__mpz_struct *)(e_acsl_83)); __gmpz_clear((__mpz_struct *)(e_acsl_84)); @@ -1309,22 +1330,19 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_88),(__mpz_struct const *)(e_acsl_87)); e_acsl_89 = __gmpz_cmp((__mpz_struct const *)(e_acsl_86), (__mpz_struct const *)(e_acsl_88)); - if (! ((e_acsl_89 >= 0) == (0 <= 0))) { - e_acsl_fail((char *)"((0>=-1) == (0<=0))"); - } + e_acsl_assert(! ((e_acsl_89 >= 0) == (0 <= 0)),(char *)"Assertion", + (char *)"((0>=-1) == (0<=0))",28); __gmpz_clear((__mpz_struct *)(e_acsl_86)); __gmpz_clear((__mpz_struct *)(e_acsl_87)); __gmpz_clear((__mpz_struct *)(e_acsl_88)); } /*@ assert (0≢1) ≡ !(0≢0); */ ; - if (! ((0 != 1) == ! (0 != 0))) { - e_acsl_fail((char *)"((0!=1) == !(0!=0))"); - } + e_acsl_assert(! ((0 != 1) == ! (0 != 0)),(char *)"Assertion", + (char *)"((0!=1) == !(0!=0))",29); /*@ assert (0≢0) ≡ !(1≢0); */ ; - if (! ((0 != 0) == ! (1 != 0))) { - e_acsl_fail((char *)"((0!=0) == !(1!=0))"); - } + e_acsl_assert(! ((0 != 0) == ! (1 != 0)),(char *)"Assertion", + (char *)"((0!=0) == !(1!=0))",31); __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/array.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/array.res.oracle index c606c5fd4ec9075774972f07347b9f939749713d..d3543e02e1f2640f7daccda85c2ab61c20767e9e 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/array.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/array.res.oracle @@ -12,33 +12,32 @@ PROJECT_FILE.i:232:[value] entering loop for the first time PROJECT_FILE.i:236:[value] assigning non deterministic value for the first time PROJECT_FILE.i:241:[value] entering loop for the first time PROJECT_FILE.i:248:[value] Assertion got status unknown. -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:249. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:251:[value] Assertion got status unknown. -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:252. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: T1[0] ∈ {0; 2} [1..2] ∈ {0; 1; 2} @@ -52,10 +51,13 @@ PROJECT_FILE.i:251:[value] Assertion got status unknown. extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -81,9 +83,11 @@ int main(void) } /*@ assert T1[0] ≡ T2[0]; */ ; - if (! (T1[0] == T2[0])) { e_acsl_fail((char *)"(T1[0] == T2[0])"); } + e_acsl_assert(! (T1[0] == T2[0]),(char *)"Assertion", + (char *)"(T1[0] == T2[0])",13); /*@ assert T1[1] ≢ T2[1]; */ ; - if (! (T1[1] != T2[1])) { e_acsl_fail((char *)"(T1[1] != T2[1])"); } + e_acsl_assert(! (T1[1] != T2[1]),(char *)"Assertion", + (char *)"(T1[1] != T2[1])",14); __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/at.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/at.res.oracle index 221b28c7ca8753cd0be69f248463bc3b67956b61..647312d9c4f34e6c0186dcd56d013ceb6ad877bb 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/at.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/at.res.oracle @@ -11,29 +11,29 @@ tests/e-acsl-runtime/at.i:33:[e-acsl] warning: missing guard for ensuring that p A ∈ {0} [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:385. -PROJECT_FILE.i:78:[value] Function __gmpz_init_set_si: postcondition got status valid. +PROJECT_FILE.i:82:[value] Function __gmpz_init_set_si: postcondition got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:386. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. Called from PROJECT_FILE.i:387. -PROJECT_FILE.i:65:[value] Function __gmpz_init: postcondition got status valid. +PROJECT_FILE.i:69:[value] Function __gmpz_init: postcondition got status valid. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. Called from PROJECT_FILE.i:388. -PROJECT_FILE.i:134:[value] Function __gmpz_add: precondition got status valid. -PROJECT_FILE.i:135:[value] Function __gmpz_add: precondition got status valid. -PROJECT_FILE.i:136:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:138:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:139:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:140:[value] Function __gmpz_add: precondition got status valid. [value] Done for function __gmpz_add [value] computing for function __gmpz_init_set <- main. Called from PROJECT_FILE.i:389. -PROJECT_FILE.i:69:[value] Function __gmpz_init_set: precondition got status valid. -PROJECT_FILE.i:70:[value] Function __gmpz_init_set: postcondition got status valid. +PROJECT_FILE.i:73:[value] Function __gmpz_init_set: precondition got status valid. +PROJECT_FILE.i:74:[value] Function __gmpz_init_set: postcondition got status valid. [value] Done for function __gmpz_init_set [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:390. -PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:391. @@ -50,20 +50,20 @@ PROJECT_FILE.i:396:[value] Assertion got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:403. -PROJECT_FILE.i:115:[value] Function __gmpz_cmp: precondition got status valid. -PROJECT_FILE.i:116:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:119:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:120:[value] Function __gmpz_cmp: precondition got status valid. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:404. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:405. [value] Done for function __gmpz_clear @@ -82,16 +82,16 @@ PROJECT_FILE.i:242:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- f <- main. Called from PROJECT_FILE.i:249. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- f <- main. +[value] computing for function e_acsl_assert <- f <- main. Called from PROJECT_FILE.i:250. -[value] computing for function printf <- e_acsl_fail <- f <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- f <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- f <- main. Called from PROJECT_FILE.i:251. [value] Done for function __gmpz_clear @@ -108,16 +108,16 @@ PROJECT_FILE.i:256:[value] Assertion got status unknown. [value] computing for function __gmpz_cmp <- f <- main. Called from PROJECT_FILE.i:263. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- f <- main. +[value] computing for function e_acsl_assert <- f <- main. Called from PROJECT_FILE.i:264. -[value] computing for function printf <- e_acsl_fail <- f <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- f <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- f <- main. Called from PROJECT_FILE.i:265. [value] Done for function __gmpz_clear @@ -134,16 +134,16 @@ PROJECT_FILE.i:270:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- f <- main. Called from PROJECT_FILE.i:278. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- f <- main. +[value] computing for function e_acsl_assert <- f <- main. Called from PROJECT_FILE.i:279. -[value] computing for function printf <- e_acsl_fail <- f <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- f <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- f <- main. Called from PROJECT_FILE.i:280. [value] Done for function __gmpz_clear @@ -160,46 +160,46 @@ PROJECT_FILE.i:285:[value] Assertion got status unknown. [value] computing for function __gmpz_cmp <- f <- main. Called from PROJECT_FILE.i:292. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- f <- main. +[value] computing for function e_acsl_assert <- f <- main. Called from PROJECT_FILE.i:293. -[value] computing for function printf <- e_acsl_fail <- f <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- f <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- f <- main. - Called from PROJECT_FILE.i:294. + Called from PROJECT_FILE.i:295. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- f <- main. - Called from PROJECT_FILE.i:295. + Called from PROJECT_FILE.i:296. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- f <- main. - Called from PROJECT_FILE.i:305. + Called from PROJECT_FILE.i:306. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- f <- main. - Called from PROJECT_FILE.i:306. + Called from PROJECT_FILE.i:307. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- f <- main. - Called from PROJECT_FILE.i:307. -[value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- f <- main. Called from PROJECT_FILE.i:308. -[value] computing for function printf <- e_acsl_fail <- f <- main. - Called from PROJECT_FILE.i:223. +[value] Done for function __gmpz_cmp +[value] computing for function e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:309. +[value] computing for function printf <- e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- f <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- f <- main. - Called from PROJECT_FILE.i:309. + Called from PROJECT_FILE.i:310. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- f <- main. - Called from PROJECT_FILE.i:310. + Called from PROJECT_FILE.i:311. [value] Done for function __gmpz_clear PROJECT_FILE.i:226:[value] Function f: postcondition got status valid. [value] Recording results for f @@ -214,16 +214,16 @@ PROJECT_FILE.i:413:[value] Assertion got status unknown. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:420. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:421. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:422. [value] Done for function __gmpz_clear @@ -237,16 +237,16 @@ PROJECT_FILE.i:427:[value] Assertion got status unknown. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:432. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:433. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:434. [value] Done for function __gmpz_clear @@ -266,16 +266,16 @@ PROJECT_FILE.i:438:[value] Assertion got status unknown. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:448. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:449. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:450. [value] Done for function __gmpz_clear @@ -287,52 +287,52 @@ PROJECT_FILE.i:438:[value] Assertion got status unknown. [value] Done for function __gmpz_clear [value] computing for function g <- main. Called from PROJECT_FILE.i:456. -PROJECT_FILE.i:334:[value] Assertion got status unknown. +PROJECT_FILE.i:335:[value] Assertion got status unknown. [value] computing for function __gmpz_init_set_si <- g <- main. - Called from PROJECT_FILE.i:339. + Called from PROJECT_FILE.i:340. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- g <- main. - Called from PROJECT_FILE.i:340. + Called from PROJECT_FILE.i:341. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- g <- main. - Called from PROJECT_FILE.i:341. -[value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- g <- main. Called from PROJECT_FILE.i:342. -[value] computing for function printf <- e_acsl_fail <- g <- main. - Called from PROJECT_FILE.i:223. +[value] Done for function __gmpz_cmp +[value] computing for function e_acsl_assert <- g <- main. + Called from PROJECT_FILE.i:343. +[value] computing for function printf <- e_acsl_assert <- g <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- g <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- g <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- g <- main. - Called from PROJECT_FILE.i:344. + Called from PROJECT_FILE.i:345. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- g <- main. - Called from PROJECT_FILE.i:345. + Called from PROJECT_FILE.i:346. [value] Done for function __gmpz_clear -PROJECT_FILE.i:350:[value] Assertion got status unknown. +PROJECT_FILE.i:351:[value] Assertion got status unknown. [value] computing for function __gmpz_init_set_si <- g <- main. - Called from PROJECT_FILE.i:356. + Called from PROJECT_FILE.i:357. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- g <- main. - Called from PROJECT_FILE.i:357. + Called from PROJECT_FILE.i:358. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- g <- main. - Called from PROJECT_FILE.i:358. + Called from PROJECT_FILE.i:359. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- g <- main. +[value] computing for function e_acsl_assert <- g <- main. Called from PROJECT_FILE.i:360. -[value] computing for function printf <- e_acsl_fail <- g <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- g <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- g <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- g <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- g <- main. Called from PROJECT_FILE.i:362. [value] Done for function __gmpz_clear @@ -347,8 +347,7 @@ PROJECT_FILE.i:350:[value] Assertion got status unknown. [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function f: A ∈ {3} e_acsl_1 ∈ {0} @@ -417,10 +416,13 @@ extern void __gmpz_add(__mpz_struct * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -449,7 +451,8 @@ void f(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_3),(long)0); e_acsl_4 = __gmpz_cmp((__mpz_struct const *)(e_acsl_2), (__mpz_struct const *)(e_acsl_3)); - if (! (e_acsl_4 == 0)) { e_acsl_fail((char *)"(\\at(A,Pre) == 0)"); } + e_acsl_assert(! (e_acsl_4 == 0),(char *)"Assertion", + (char *)"(\\at(A,Pre) == 0)",12); __gmpz_clear((__mpz_struct *)(e_acsl_2)); __gmpz_clear((__mpz_struct *)(e_acsl_3)); } @@ -463,7 +466,8 @@ void f(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_7),(long)1); e_acsl_8 = __gmpz_cmp((__mpz_struct const *)(e_acsl_6), (__mpz_struct const *)(e_acsl_7)); - if (! (e_acsl_8 == 0)) { e_acsl_fail((char *)"(\\at(A,F) == 1)"); } + e_acsl_assert(! (e_acsl_8 == 0),(char *)"Assertion", + (char *)"(\\at(A,F) == 1)",13); __gmpz_clear((__mpz_struct *)(e_acsl_6)); __gmpz_clear((__mpz_struct *)(e_acsl_7)); } @@ -478,7 +482,8 @@ void f(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_11),(long)2); e_acsl_12 = __gmpz_cmp((__mpz_struct const *)(e_acsl_10), (__mpz_struct const *)(e_acsl_11)); - if (! (e_acsl_12 == 0)) { e_acsl_fail((char *)"(\\at(A,Here) == 2)"); } + e_acsl_assert(! (e_acsl_12 == 0),(char *)"Assertion", + (char *)"(\\at(A,Here) == 2)",14); __gmpz_clear((__mpz_struct *)(e_acsl_10)); __gmpz_clear((__mpz_struct *)(e_acsl_11)); } @@ -492,9 +497,8 @@ void f(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_16),(long)0); e_acsl_17 = __gmpz_cmp((__mpz_struct const *)(e_acsl_15), (__mpz_struct const *)(e_acsl_16)); - if (! (e_acsl_17 == 0)) { - e_acsl_fail((char *)"(\\at(\\at(A,Pre),F) == 0)"); - } + e_acsl_assert(! (e_acsl_17 == 0),(char *)"Assertion", + (char *)"(\\at(\\at(A,Pre),F) == 0)",15); __gmpz_clear((__mpz_struct *)(e_acsl_15)); __gmpz_clear((__mpz_struct *)(e_acsl_16)); } @@ -509,7 +513,8 @@ void f(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_20),(long)3); e_acsl_21 = __gmpz_cmp((__mpz_struct const *)(e_acsl_19), (__mpz_struct const *)(e_acsl_20)); - if (! (e_acsl_21 == 0)) { e_acsl_fail((char *)"(\\at(A,Post) == 3)"); } + e_acsl_assert(! (e_acsl_21 == 0),(char *)"Postcondition", + (char *)"(\\at(A,Post) == 3)",8); __gmpz_clear((__mpz_struct *)(e_acsl_19)); __gmpz_clear((__mpz_struct *)(e_acsl_20)); return; @@ -542,9 +547,8 @@ void g(int *p, int *q) __gmpz_init_set_si((__mpz_struct *)(e_acsl_4),(long)2); e_acsl_5 = __gmpz_cmp((__mpz_struct const *)(e_acsl_3), (__mpz_struct const *)(e_acsl_4)); - if (! (e_acsl_5 == 0)) { - e_acsl_fail((char *)"(\\at(*(p+\\at(*q,L1)),L2) == 2)"); - } + e_acsl_assert(! (e_acsl_5 == 0),(char *)"Assertion", + (char *)"(\\at(*(p+\\at(*q,L1)),L2) == 2)",31); __gmpz_clear((__mpz_struct *)(e_acsl_3)); __gmpz_clear((__mpz_struct *)(e_acsl_4)); } @@ -560,9 +564,8 @@ void g(int *p, int *q) __gmpz_init_set_si((__mpz_struct *)(e_acsl_9),(long)2); e_acsl_10 = __gmpz_cmp((__mpz_struct const *)(e_acsl_8), (__mpz_struct const *)(e_acsl_9)); - if (! (e_acsl_10 == 0)) { - e_acsl_fail((char *)"(\\at(*(p+\\at(*q,L1)),Here) == 2)"); - } + e_acsl_assert(! (e_acsl_10 == 0),(char *)"Assertion", + (char *)"(\\at(*(p+\\at(*q,L1)),Here) == 2)",33); __gmpz_clear((__mpz_struct *)(e_acsl_8)); __gmpz_clear((__mpz_struct *)(e_acsl_9)); } @@ -606,7 +609,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)0); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(x == 0)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Assertion",(char *)"(x == 0)", + 44); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } @@ -623,7 +627,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_6),(long)0); e_acsl_7 = __gmpz_cmp((__mpz_struct const *)(e_acsl_5), (__mpz_struct const *)(e_acsl_6)); - if (! (e_acsl_7 == 0)) { e_acsl_fail((char *)"(\\at(x,L) == 0)"); } + e_acsl_assert(! (e_acsl_7 == 0),(char *)"Assertion", + (char *)"(\\at(x,L) == 0)",49); __gmpz_clear((__mpz_struct *)(e_acsl_5)); __gmpz_clear((__mpz_struct *)(e_acsl_6)); } @@ -635,7 +640,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_12),(long)1); e_acsl_13 = __gmpz_cmp((__mpz_struct const *)(e_acsl_11), (__mpz_struct const *)(e_acsl_12)); - if (! (e_acsl_13 == 0)) { e_acsl_fail((char *)"(\\at(x+1,L) == 1)"); } + e_acsl_assert(! (e_acsl_13 == 0),(char *)"Assertion", + (char *)"(\\at(x+1,L) == 1)",50); __gmpz_clear((__mpz_struct *)(e_acsl_12)); } @@ -652,7 +658,8 @@ int main(void) (__mpz_struct const *)(e_acsl_16)); e_acsl_18 = __gmpz_cmp((__mpz_struct const *)(e_acsl_17), (__mpz_struct const *)(e_acsl_16)); - if (! (e_acsl_18 == 0)) { e_acsl_fail((char *)"(\\at(x,L)+1 == 1)"); } + e_acsl_assert(! (e_acsl_18 == 0),(char *)"Assertion", + (char *)"(\\at(x,L)+1 == 1)",51); __gmpz_clear((__mpz_struct *)(e_acsl_15)); __gmpz_clear((__mpz_struct *)(e_acsl_16)); __gmpz_clear((__mpz_struct *)(e_acsl_17)); diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/cast.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/cast.res.oracle index 2f2725ee17bbb3e12796a49af1445ebf91d91cf7..d3916d0eff220064581f7f15076359751385c69f 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/cast.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/cast.res.oracle @@ -7,53 +7,52 @@ tests/e-acsl-runtime/cast.i:18:[e-acsl] warning: missing guard for ensuring that PROJECT_FILE.i:232:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_str <- main. Called from PROJECT_FILE.i:236. -PROJECT_FILE.i:82:[value] Function __gmpz_init_set_str: postcondition got status valid. +PROJECT_FILE.i:86:[value] Function __gmpz_init_set_str: postcondition got status valid. [value] Done for function __gmpz_init_set_str [value] computing for function __gmpz_get_si <- main. Called from PROJECT_FILE.i:237. -PROJECT_FILE.i:168:[value] Function __gmpz_get_si: precondition got status valid. +PROJECT_FILE.i:172:[value] Function __gmpz_get_si: precondition got status valid. [value] Done for function __gmpz_get_si -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:238. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:239. -PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. + Called from PROJECT_FILE.i:240. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_clear -PROJECT_FILE.i:243:[value] Assertion got status valid. +PROJECT_FILE.i:244:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_str <- main. - Called from PROJECT_FILE.i:247. + Called from PROJECT_FILE.i:248. [value] Done for function __gmpz_init_set_str [value] computing for function __gmpz_get_ui <- main. - Called from PROJECT_FILE.i:248. -PROJECT_FILE.i:172:[value] Function __gmpz_get_ui: precondition got status valid. + Called from PROJECT_FILE.i:249. +PROJECT_FILE.i:176:[value] Function __gmpz_get_ui: precondition got status valid. [value] Done for function __gmpz_get_ui -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:250. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:252. [value] Done for function __gmpz_clear [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} x ∈ {0} @@ -85,10 +84,13 @@ extern unsigned long __gmpz_get_ui(__mpz_struct const * /*[1]*/ z); extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -105,9 +107,8 @@ int main(void) int e_acsl_2; __gmpz_init_set_str((__mpz_struct *)(e_acsl_1),"1152921504606846975",10); e_acsl_2 = (int)__gmpz_get_si((__mpz_struct const *)(e_acsl_1)); - if (! (y != e_acsl_2)) { - e_acsl_fail((char *)"(y != (int)0xfffffffffffffff)"); - } + e_acsl_assert(! (y != e_acsl_2),(char *)"Assertion", + (char *)"(y != (int)0xfffffffffffffff)",17); __gmpz_clear((__mpz_struct *)(e_acsl_1)); } @@ -117,9 +118,9 @@ int main(void) unsigned int e_acsl_4; __gmpz_init_set_str((__mpz_struct *)(e_acsl_3),"1152921504606846975",10); e_acsl_4 = (unsigned int)__gmpz_get_ui((__mpz_struct const *)(e_acsl_3)); - if (! ((unsigned int)y != e_acsl_4)) { - e_acsl_fail((char *)"((unsigned int)y != (unsigned int)0xfffffffffffffff)"); - } + e_acsl_assert(! ((unsigned int)y != e_acsl_4),(char *)"Assertion", + (char *)"((unsigned int)y != (unsigned int)0xfffffffffffffff)", + 18); __gmpz_clear((__mpz_struct *)(e_acsl_3)); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/comparison.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/comparison.res.oracle index 7516ab5f3a175889b9bb4a24442817c1ede99f45..8b5e523c1ec24a01754423d552e84cc08298f18c 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/comparison.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/comparison.res.oracle @@ -3,34 +3,42 @@ [value] Initial state computed [value] Values of globals at initialization PROJECT_FILE.i:233:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:234. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:236:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:237. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:239:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:244. -PROJECT_FILE.i:78:[value] Function __gmpz_init_set_si: postcondition got status valid. +PROJECT_FILE.i:82:[value] Function __gmpz_init_set_si: postcondition got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:245. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:246. -PROJECT_FILE.i:115:[value] Function __gmpz_cmp: precondition got status valid. -PROJECT_FILE.i:116:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:119:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:120:[value] Function __gmpz_cmp: precondition got status valid. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:247. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:248. -PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:249. @@ -45,16 +53,16 @@ PROJECT_FILE.i:253:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:260. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:261. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:262. [value] Done for function __gmpz_clear @@ -62,25 +70,57 @@ PROJECT_FILE.i:253:[value] Assertion got status valid. Called from PROJECT_FILE.i:263. [value] Done for function __gmpz_clear PROJECT_FILE.i:268:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:269. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:271:[value] Assertion got status unknown. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:272. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:274:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:275. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:277:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:278. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:280:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:281. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:283:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:284. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:286:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:287. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:289:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:290. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:292:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:298. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. Called from PROJECT_FILE.i:299. -PROJECT_FILE.i:65:[value] Function __gmpz_init: postcondition got status valid. +PROJECT_FILE.i:69:[value] Function __gmpz_init: postcondition got status valid. [value] Done for function __gmpz_init [value] computing for function __gmpz_neg <- main. Called from PROJECT_FILE.i:300. -PROJECT_FILE.i:129:[value] Function __gmpz_neg: precondition got status valid. -PROJECT_FILE.i:130:[value] Function __gmpz_neg: precondition got status valid. +PROJECT_FILE.i:133:[value] Function __gmpz_neg: precondition got status valid. +PROJECT_FILE.i:134:[value] Function __gmpz_neg: precondition got status valid. [value] Done for function __gmpz_neg [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:301. @@ -88,16 +128,16 @@ PROJECT_FILE.i:130:[value] Function __gmpz_neg: precondition got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:302. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:303. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:304. [value] Done for function __gmpz_clear @@ -123,16 +163,16 @@ PROJECT_FILE.i:310:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:320. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:321. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:322. [value] Done for function __gmpz_clear @@ -158,16 +198,16 @@ PROJECT_FILE.i:328:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:338. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:339. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:340. [value] Done for function __gmpz_clear @@ -193,16 +233,16 @@ PROJECT_FILE.i:346:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:356. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:357. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:358. [value] Done for function __gmpz_clear @@ -225,16 +265,16 @@ PROJECT_FILE.i:364:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:372. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:373. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:374. [value] Done for function __gmpz_clear @@ -257,16 +297,16 @@ PROJECT_FILE.i:379:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:389. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:390. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:391. [value] Done for function __gmpz_clear @@ -279,8 +319,7 @@ PROJECT_FILE.i:379:[value] Assertion got status valid. [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} x ∈ {0} @@ -320,10 +359,13 @@ extern void __gmpz_neg(__mpz_struct * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -336,9 +378,9 @@ int main(void) x = 0; y = 1; /*@ assert x < y; */ ; - if (! (x < y)) { e_acsl_fail((char *)"(x < y)"); } + e_acsl_assert(! (x < y),(char *)"Assertion",(char *)"(x < y)",8); /*@ assert y > x; */ ; - if (! (y > x)) { e_acsl_fail((char *)"(y > x)"); } + e_acsl_assert(! (y > x),(char *)"Assertion",(char *)"(y > x)",9); /*@ assert x ≤ 0; */ ; { mpz_t e_acsl_1; @@ -348,7 +390,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)0); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 <= 0)) { e_acsl_fail((char *)"(x <= 0)"); } + e_acsl_assert(! (e_acsl_3 <= 0),(char *)"Assertion",(char *)"(x <= 0)", + 10); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } @@ -362,29 +405,31 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)1); e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_6 >= 0)) { e_acsl_fail((char *)"(y >= 1)"); } + e_acsl_assert(! (e_acsl_6 >= 0),(char *)"Assertion",(char *)"(y >= 1)", + 11); __gmpz_clear((__mpz_struct *)(e_acsl_4)); __gmpz_clear((__mpz_struct *)(e_acsl_5)); } s = (char *)"toto"; /*@ assert s ≡ s; */ ; - if (! (s == s)) { e_acsl_fail((char *)"(s == s)"); } + e_acsl_assert(! (s == s),(char *)"Assertion",(char *)"(s == s)",13); /*@ assert "toto" ≢ "titi"; */ ; - if (! ("toto" != "titi")) { e_acsl_fail((char *)"(\"toto\" != \"titi\")"); - } + e_acsl_assert(! ("toto" != "titi"),(char *)"Assertion", + (char *)"(\"toto\" != \"titi\")",14); /*@ assert 5 < 18; */ ; - if (! (5 < 18)) { e_acsl_fail((char *)"(5 < 18)"); } + e_acsl_assert(! (5 < 18),(char *)"Assertion",(char *)"(5 < 18)",15); /*@ assert 32 > 3; */ ; - if (! (32 > 3)) { e_acsl_fail((char *)"(32 > 3)"); } + e_acsl_assert(! (32 > 3),(char *)"Assertion",(char *)"(32 > 3)",16); /*@ assert 12 ≤ 13; */ ; - if (! (12 <= 13)) { e_acsl_fail((char *)"(12 <= 13)"); } + e_acsl_assert(! (12 <= 13),(char *)"Assertion",(char *)"(12 <= 13)",17); /*@ assert 123 ≥ 12; */ ; - if (! (123 >= 12)) { e_acsl_fail((char *)"(123 >= 12)"); } + e_acsl_assert(! (123 >= 12),(char *)"Assertion",(char *)"(123 >= 12)",18); /*@ assert 0xff ≡ 0xff; */ ; - if (! (0xff == 0xff)) { e_acsl_fail((char *)"(0xff == 0xff)"); } + e_acsl_assert(! (0xff == 0xff),(char *)"Assertion", + (char *)"(0xff == 0xff)",19); /*@ assert 1 ≢ 2; */ ; - if (! (1 != 2)) { e_acsl_fail((char *)"(1 != 2)"); } + e_acsl_assert(! (1 != 2),(char *)"Assertion",(char *)"(1 != 2)",20); /*@ assert -5 < 18; */ ; { mpz_t e_acsl_7; @@ -397,7 +442,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_9),(long)18); e_acsl_10 = __gmpz_cmp((__mpz_struct const *)(e_acsl_8), (__mpz_struct const *)(e_acsl_9)); - if (! (e_acsl_10 < 0)) { e_acsl_fail((char *)"(-5 < 18)"); } + e_acsl_assert(! (e_acsl_10 < 0),(char *)"Assertion",(char *)"(-5 < 18)", + 22); __gmpz_clear((__mpz_struct *)(e_acsl_7)); __gmpz_clear((__mpz_struct *)(e_acsl_8)); __gmpz_clear((__mpz_struct *)(e_acsl_9)); @@ -415,7 +461,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_13),(__mpz_struct const *)(e_acsl_12)); e_acsl_14 = __gmpz_cmp((__mpz_struct const *)(e_acsl_11), (__mpz_struct const *)(e_acsl_13)); - if (! (e_acsl_14 > 0)) { e_acsl_fail((char *)"(32 > -3)"); } + e_acsl_assert(! (e_acsl_14 > 0),(char *)"Assertion",(char *)"(32 > -3)", + 23); __gmpz_clear((__mpz_struct *)(e_acsl_11)); __gmpz_clear((__mpz_struct *)(e_acsl_12)); __gmpz_clear((__mpz_struct *)(e_acsl_13)); @@ -433,7 +480,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_17),(long)13); e_acsl_18 = __gmpz_cmp((__mpz_struct const *)(e_acsl_16), (__mpz_struct const *)(e_acsl_17)); - if (! (e_acsl_18 <= 0)) { e_acsl_fail((char *)"(-12 <= 13)"); } + e_acsl_assert(! (e_acsl_18 <= 0),(char *)"Assertion", + (char *)"(-12 <= 13)",24); __gmpz_clear((__mpz_struct *)(e_acsl_15)); __gmpz_clear((__mpz_struct *)(e_acsl_16)); __gmpz_clear((__mpz_struct *)(e_acsl_17)); @@ -451,7 +499,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_21),(__mpz_struct const *)(e_acsl_20)); e_acsl_22 = __gmpz_cmp((__mpz_struct const *)(e_acsl_19), (__mpz_struct const *)(e_acsl_21)); - if (! (e_acsl_22 >= 0)) { e_acsl_fail((char *)"(123 >= -12)"); } + e_acsl_assert(! (e_acsl_22 >= 0),(char *)"Assertion", + (char *)"(123 >= -12)",25); __gmpz_clear((__mpz_struct *)(e_acsl_19)); __gmpz_clear((__mpz_struct *)(e_acsl_20)); __gmpz_clear((__mpz_struct *)(e_acsl_21)); @@ -467,7 +516,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_24),(__mpz_struct const *)(e_acsl_23)); e_acsl_25 = __gmpz_cmp((__mpz_struct const *)(e_acsl_24), (__mpz_struct const *)(e_acsl_24)); - if (! (e_acsl_25 == 0)) { e_acsl_fail((char *)"(-0xff == -0xff)"); } + e_acsl_assert(! (e_acsl_25 == 0),(char *)"Assertion", + (char *)"(-0xff == -0xff)",26); __gmpz_clear((__mpz_struct *)(e_acsl_23)); __gmpz_clear((__mpz_struct *)(e_acsl_24)); } @@ -484,7 +534,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_28),(__mpz_struct const *)(e_acsl_27)); e_acsl_29 = __gmpz_cmp((__mpz_struct const *)(e_acsl_26), (__mpz_struct const *)(e_acsl_28)); - if (! (e_acsl_29 != 0)) { e_acsl_fail((char *)"(1 != -2)"); } + e_acsl_assert(! (e_acsl_29 != 0),(char *)"Assertion",(char *)"(1 != -2)", + 27); __gmpz_clear((__mpz_struct *)(e_acsl_26)); __gmpz_clear((__mpz_struct *)(e_acsl_27)); __gmpz_clear((__mpz_struct *)(e_acsl_28)); diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/false.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/false.res.oracle index ef3b4b4c178ad80a36b4868217852482458f2767..0b3a456203d5ca35ed44adad97f274270d922703 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/false.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/false.res.oracle @@ -15,10 +15,13 @@ extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -29,7 +32,8 @@ int main(void) x = 0; if (x) { /*@ assert \false; */ ; - e_acsl_fail((char *)"(\\false)"); } + e_acsl_assert(1,(char *)"Assertion",(char *)"(\\false)",7); + } __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/function_contract.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/function_contract.res.oracle index 84ac5cd9e153f98743e38fa0892d2a3890b18b69..d18b31cbb5285e9e385b6c642805ee0fa93dd16a 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/function_contract.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/function_contract.res.oracle @@ -5,33 +5,33 @@ X ∈ {0} Y ∈ {2} [value] computing for function f <- main. - Called from PROJECT_FILE.i:539. + Called from PROJECT_FILE.i:681. [value] computing for function __gmpz_init_set_si <- f <- main. Called from PROJECT_FILE.i:235. -PROJECT_FILE.i:78:[value] Function __gmpz_init_set_si: postcondition got status valid. +PROJECT_FILE.i:82:[value] Function __gmpz_init_set_si: postcondition got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- f <- main. Called from PROJECT_FILE.i:236. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- f <- main. Called from PROJECT_FILE.i:237. -PROJECT_FILE.i:115:[value] Function __gmpz_cmp: precondition got status valid. -PROJECT_FILE.i:116:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:119:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:120:[value] Function __gmpz_cmp: precondition got status valid. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- f <- main. +[value] computing for function e_acsl_assert <- f <- main. Called from PROJECT_FILE.i:238. -[value] computing for function printf <- e_acsl_fail <- f <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- f <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- f <- main. Called from PROJECT_FILE.i:239. -PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- f <- main. Called from PROJECT_FILE.i:240. @@ -40,7 +40,7 @@ PROJECT_FILE.i:227:[value] Function f: postcondition got status valid. [value] Recording results for f [value] Done for function f [value] computing for function g <- main. - Called from PROJECT_FILE.i:540. + Called from PROJECT_FILE.i:682. [value] computing for function __gmpz_init_set_si <- g <- main. Called from PROJECT_FILE.i:257. [value] Done for function __gmpz_init_set_si @@ -50,32 +50,32 @@ PROJECT_FILE.i:227:[value] Function f: postcondition got status valid. [value] computing for function __gmpz_cmp <- g <- main. Called from PROJECT_FILE.i:259. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- g <- main. +[value] computing for function e_acsl_assert <- g <- main. Called from PROJECT_FILE.i:260. -[value] computing for function printf <- e_acsl_fail <- g <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- g <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- g <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- g <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_init_set_si <- g <- main. Called from PROJECT_FILE.i:261. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- g <- main. Called from PROJECT_FILE.i:262. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- g <- main. +[value] computing for function e_acsl_assert <- g <- main. Called from PROJECT_FILE.i:263. -[value] computing for function printf <- e_acsl_fail <- g <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- g <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- g <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- g <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- g <- main. Called from PROJECT_FILE.i:264. [value] Done for function __gmpz_clear @@ -90,7 +90,7 @@ PROJECT_FILE.i:247:[value] Function g: postcondition got status valid. [value] Recording results for g [value] Done for function g [value] computing for function h <- main. - Called from PROJECT_FILE.i:541. + Called from PROJECT_FILE.i:683. PROJECT_FILE.i:272:[value] Function h: precondition got status valid. [value] computing for function __gmpz_init_set_si <- h <- main. Called from PROJECT_FILE.i:279. @@ -101,16 +101,16 @@ PROJECT_FILE.i:272:[value] Function h: precondition got status valid. [value] computing for function __gmpz_cmp <- h <- main. Called from PROJECT_FILE.i:281. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- h <- main. +[value] computing for function e_acsl_assert <- h <- main. Called from PROJECT_FILE.i:282. -[value] computing for function printf <- e_acsl_fail <- h <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- h <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- h <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- h <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- h <- main. Called from PROJECT_FILE.i:283. [value] Done for function __gmpz_clear @@ -120,7 +120,7 @@ PROJECT_FILE.i:272:[value] Function h: precondition got status valid. [value] Recording results for h [value] Done for function h [value] computing for function i <- main. - Called from PROJECT_FILE.i:542. + Called from PROJECT_FILE.i:684. PROJECT_FILE.i:291:[value] Function i: precondition got status valid. PROJECT_FILE.i:292:[value] Function i: precondition got status valid. [value] computing for function __gmpz_init_set_si <- i <- main. @@ -132,16 +132,16 @@ PROJECT_FILE.i:292:[value] Function i: precondition got status valid. [value] computing for function __gmpz_cmp <- i <- main. Called from PROJECT_FILE.i:304. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- i <- main. +[value] computing for function e_acsl_assert <- i <- main. Called from PROJECT_FILE.i:305. -[value] computing for function printf <- e_acsl_fail <- i <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- i <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- i <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- i <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_init_set_si <- i <- main. Called from PROJECT_FILE.i:306. [value] Done for function __gmpz_init_set_si @@ -151,16 +151,16 @@ PROJECT_FILE.i:292:[value] Function i: precondition got status valid. [value] computing for function __gmpz_cmp <- i <- main. Called from PROJECT_FILE.i:308. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- i <- main. +[value] computing for function e_acsl_assert <- i <- main. Called from PROJECT_FILE.i:309. -[value] computing for function printf <- e_acsl_fail <- i <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- i <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- i <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- i <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- i <- main. Called from PROJECT_FILE.i:310. [value] Done for function __gmpz_clear @@ -176,7 +176,7 @@ PROJECT_FILE.i:292:[value] Function i: precondition got status valid. [value] Recording results for i [value] Done for function i [value] computing for function j <- main. - Called from PROJECT_FILE.i:543. + Called from PROJECT_FILE.i:685. PROJECT_FILE.i:321:[value] Function j, behavior b1: precondition got status valid. PROJECT_FILE.i:325:[value] Function j, behavior b2: precondition got status valid. PROJECT_FILE.i:326:[value] Function j, behavior b2: precondition got status valid. @@ -189,16 +189,16 @@ PROJECT_FILE.i:326:[value] Function j, behavior b2: precondition got status vali [value] computing for function __gmpz_cmp <- j <- main. Called from PROJECT_FILE.i:345. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- j <- main. +[value] computing for function e_acsl_assert <- j <- main. Called from PROJECT_FILE.i:346. -[value] computing for function printf <- e_acsl_fail <- j <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- j <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- j <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- j <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_init_set_si <- j <- main. Called from PROJECT_FILE.i:347. [value] Done for function __gmpz_init_set_si @@ -207,43 +207,43 @@ PROJECT_FILE.i:326:[value] Function j, behavior b2: precondition got status vali [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- j <- main. Called from PROJECT_FILE.i:349. -PROJECT_FILE.i:65:[value] Function __gmpz_init: postcondition got status valid. +PROJECT_FILE.i:69:[value] Function __gmpz_init: postcondition got status valid. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- j <- main. Called from PROJECT_FILE.i:350. -PROJECT_FILE.i:134:[value] Function __gmpz_add: precondition got status valid. -PROJECT_FILE.i:135:[value] Function __gmpz_add: precondition got status valid. -PROJECT_FILE.i:136:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:138:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:139:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:140:[value] Function __gmpz_add: precondition got status valid. [value] Done for function __gmpz_add [value] computing for function __gmpz_cmp <- j <- main. Called from PROJECT_FILE.i:351. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- j <- main. +[value] computing for function e_acsl_assert <- j <- main. Called from PROJECT_FILE.i:352. -[value] computing for function printf <- e_acsl_fail <- j <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- j <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- j <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- j <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_init_set_si <- j <- main. Called from PROJECT_FILE.i:353. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- j <- main. Called from PROJECT_FILE.i:354. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- j <- main. +[value] computing for function e_acsl_assert <- j <- main. Called from PROJECT_FILE.i:355. -[value] computing for function printf <- e_acsl_fail <- j <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- j <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- j <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- j <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- j <- main. Called from PROJECT_FILE.i:356. [value] Done for function __gmpz_clear @@ -271,16 +271,16 @@ PROJECT_FILE.i:136:[value] Function __gmpz_add: precondition got status valid. [value] computing for function __gmpz_cmp <- j <- main. Called from PROJECT_FILE.i:375. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- j <- main. +[value] computing for function e_acsl_assert <- j <- main. Called from PROJECT_FILE.i:376. -[value] computing for function printf <- e_acsl_fail <- j <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- j <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- j <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- j <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_init_set_si <- j <- main. Called from PROJECT_FILE.i:377. [value] Done for function __gmpz_init_set_si @@ -296,16 +296,16 @@ PROJECT_FILE.i:136:[value] Function __gmpz_add: precondition got status valid. [value] computing for function __gmpz_cmp <- j <- main. Called from PROJECT_FILE.i:381. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- j <- main. +[value] computing for function e_acsl_assert <- j <- main. Called from PROJECT_FILE.i:382. -[value] computing for function printf <- e_acsl_fail <- j <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- j <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- j <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- j <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- j <- main. Called from PROJECT_FILE.i:383. [value] Done for function __gmpz_clear @@ -326,7 +326,7 @@ PROJECT_FILE.i:327:[value] Function j, behavior b2: postcondition got status val [value] Recording results for j [value] Done for function j [value] computing for function k <- main. - Called from PROJECT_FILE.i:544. + Called from PROJECT_FILE.i:686. PROJECT_FILE.i:395:[value] Function k, behavior b1: assumption got status invalid; precondition not evaluated. PROJECT_FILE.i:400:[value] Function k, behavior b2: precondition got status valid. PROJECT_FILE.i:401:[value] Function k, behavior b2: precondition got status valid. @@ -355,16 +355,16 @@ PROJECT_FILE.i:430:[value] assigning non deterministic value for the first time [value] computing for function __gmpz_clear <- k <- main. Called from PROJECT_FILE.i:432. [value] Done for function __gmpz_clear -[value] computing for function e_acsl_fail <- k <- main. +[value] computing for function e_acsl_assert <- k <- main. Called from PROJECT_FILE.i:434. -[value] computing for function printf <- e_acsl_fail <- k <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- k <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- k <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- k <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_init_set_si <- k <- main. Called from PROJECT_FILE.i:435. [value] Done for function __gmpz_init_set_si @@ -401,55 +401,52 @@ PROJECT_FILE.i:430:[value] assigning non deterministic value for the first time [value] computing for function __gmpz_clear <- k <- main. Called from PROJECT_FILE.i:459. [value] Done for function __gmpz_clear -[value] computing for function e_acsl_fail <- k <- main. +[value] computing for function e_acsl_assert <- k <- main. Called from PROJECT_FILE.i:461. -[value] computing for function printf <- e_acsl_fail <- k <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- k <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- k <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- k <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_cmp <- k <- main. - Called from PROJECT_FILE.i:462. + Called from PROJECT_FILE.i:463. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_init_set_si <- k <- main. - Called from PROJECT_FILE.i:467. + Called from PROJECT_FILE.i:468. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- k <- main. - Called from PROJECT_FILE.i:468. + Called from PROJECT_FILE.i:469. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- k <- main. - Called from PROJECT_FILE.i:469. + Called from PROJECT_FILE.i:470. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_clear <- k <- main. - Called from PROJECT_FILE.i:471. + Called from PROJECT_FILE.i:472. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- k <- main. - Called from PROJECT_FILE.i:472. + Called from PROJECT_FILE.i:473. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- k <- main. - Called from PROJECT_FILE.i:482. + Called from PROJECT_FILE.i:483. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- k <- main. - Called from PROJECT_FILE.i:483. + Called from PROJECT_FILE.i:484. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- k <- main. - Called from PROJECT_FILE.i:484. + Called from PROJECT_FILE.i:485. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- k <- main. - Called from PROJECT_FILE.i:485. + Called from PROJECT_FILE.i:486. [value] Done for function __gmpz_add [value] computing for function __gmpz_init_set_si <- k <- main. - Called from PROJECT_FILE.i:486. + Called from PROJECT_FILE.i:487. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- k <- main. - Called from PROJECT_FILE.i:487. + Called from PROJECT_FILE.i:488. [value] Done for function __gmpz_cmp -[value] computing for function __gmpz_clear <- k <- main. - Called from PROJECT_FILE.i:489. -[value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- k <- main. Called from PROJECT_FILE.i:490. [value] Done for function __gmpz_clear @@ -459,88 +456,262 @@ PROJECT_FILE.i:430:[value] assigning non deterministic value for the first time [value] computing for function __gmpz_clear <- k <- main. Called from PROJECT_FILE.i:492. [value] Done for function __gmpz_clear -[value] computing for function e_acsl_fail <- k <- main. - Called from PROJECT_FILE.i:494. -[value] computing for function printf <- e_acsl_fail <- k <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function __gmpz_clear <- k <- main. + Called from PROJECT_FILE.i:493. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- k <- main. + Called from PROJECT_FILE.i:495. +[value] computing for function printf <- e_acsl_assert <- k <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- k <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- k <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- k <- main. - Called from PROJECT_FILE.i:495. + Called from PROJECT_FILE.i:497. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- k <- main. - Called from PROJECT_FILE.i:496. + Called from PROJECT_FILE.i:498. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- k <- main. - Called from PROJECT_FILE.i:497. + Called from PROJECT_FILE.i:499. [value] Done for function __gmpz_clear [value] Recording results for k [value] Done for function k [value] computing for function l <- main. - Called from PROJECT_FILE.i:545. -PROJECT_FILE.i:507:[value] Assertion got status valid. + Called from PROJECT_FILE.i:687. +PROJECT_FILE.i:509:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- l <- main. - Called from PROJECT_FILE.i:512. + Called from PROJECT_FILE.i:514. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- l <- main. - Called from PROJECT_FILE.i:513. + Called from PROJECT_FILE.i:515. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- l <- main. - Called from PROJECT_FILE.i:514. + Called from PROJECT_FILE.i:516. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- l <- main. - Called from PROJECT_FILE.i:515. -[value] computing for function printf <- e_acsl_fail <- l <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- l <- main. + Called from PROJECT_FILE.i:517. +[value] computing for function printf <- e_acsl_assert <- l <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- l <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- l <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- l <- main. - Called from PROJECT_FILE.i:516. + Called from PROJECT_FILE.i:518. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- l <- main. - Called from PROJECT_FILE.i:517. + Called from PROJECT_FILE.i:519. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- l <- main. - Called from PROJECT_FILE.i:525. + Called from PROJECT_FILE.i:527. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- l <- main. - Called from PROJECT_FILE.i:526. + Called from PROJECT_FILE.i:528. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- l <- main. - Called from PROJECT_FILE.i:527. + Called from PROJECT_FILE.i:529. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- l <- main. - Called from PROJECT_FILE.i:528. -[value] computing for function printf <- e_acsl_fail <- l <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- l <- main. + Called from PROJECT_FILE.i:530. +[value] computing for function printf <- e_acsl_assert <- l <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- l <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- l <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- l <- main. - Called from PROJECT_FILE.i:529. + Called from PROJECT_FILE.i:531. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- l <- main. - Called from PROJECT_FILE.i:530. + Called from PROJECT_FILE.i:532. [value] Done for function __gmpz_clear -PROJECT_FILE.i:504:[value] Function l: postcondition got status valid. +PROJECT_FILE.i:506:[value] Function l: postcondition got status valid. [value] Recording results for l [value] Done for function l +[value] computing for function m <- main. + Called from PROJECT_FILE.i:688. +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:562. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:563. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- m <- main. + Called from PROJECT_FILE.i:564. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:569. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:570. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- m <- main. + Called from PROJECT_FILE.i:571. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:573. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:574. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:578. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:579. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:587. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:588. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- m <- main. + Called from PROJECT_FILE.i:589. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:594. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:595. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- m <- main. + Called from PROJECT_FILE.i:596. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:598. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:599. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:603. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:604. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:611. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:612. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- m <- main. + Called from PROJECT_FILE.i:613. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:615. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:616. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:629. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:630. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- m <- main. + Called from PROJECT_FILE.i:631. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:633. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:634. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- m <- main. + Called from PROJECT_FILE.i:636. +[value] computing for function printf <- e_acsl_assert <- m <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- m <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:643. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:644. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- m <- main. + Called from PROJECT_FILE.i:645. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:647. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:648. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- m <- main. + Called from PROJECT_FILE.i:650. +[value] computing for function printf <- e_acsl_assert <- m <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- m <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:659. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:660. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- m <- main. + Called from PROJECT_FILE.i:661. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init <- m <- main. + Called from PROJECT_FILE.i:662. +[value] Done for function __gmpz_init +[value] computing for function __gmpz_add <- m <- main. + Called from PROJECT_FILE.i:663. +[value] Done for function __gmpz_add +[value] computing for function __gmpz_cmp <- m <- main. + Called from PROJECT_FILE.i:664. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:666. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:667. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:668. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- m <- main. + Called from PROJECT_FILE.i:669. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- m <- main. + Called from PROJECT_FILE.i:671. +[value] computing for function printf <- e_acsl_assert <- m <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- m <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +PROJECT_FILE.i:540:[value] Function m, behavior b1: assumes got status invalid; post-condition not evaluated. +PROJECT_FILE.i:545:[value] Function m, behavior b2: postcondition got status valid. +PROJECT_FILE.i:546:[value] Function m, behavior b2: postcondition got status valid. +[value] Recording results for m +[value] Done for function m [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function f: X ∈ {1} [value] Values at end of function g: @@ -554,8 +725,14 @@ PROJECT_FILE.i:504:[value] Function l: postcondition got status valid. [value] Values at end of function k: X ∈ {5} [value] Values at end of function l: +[value] Values at end of function m: + X ∈ {7} + e_acsl_4 ∈ {0; 1} + e_acsl_16 ∈ {0; 1} + e_acsl_28 ∈ {0; 1} + e_acsl_30 ∈ {5} [value] Values at end of function main: - X ∈ {5} + X ∈ {7} __retres ∈ {0} /* Generated by Frama-C */ struct __anonstruct___mpz_struct_1 { @@ -594,10 +771,13 @@ extern void __gmpz_add(__mpz_struct * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -615,7 +795,8 @@ void f(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)1); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(X == 1)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Postcondition", + (char *)"(X == 1)",9); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); return; @@ -638,11 +819,13 @@ void g(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)2); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(X == 2)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Postcondition", + (char *)"(X == 2)",13); __gmpz_init_set_si((__mpz_struct *)(e_acsl_4),(long)Y); e_acsl_5 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_5 == 0)) { e_acsl_fail((char *)"(Y == 2)"); } + e_acsl_assert(! (e_acsl_5 == 0),(char *)"Postcondition", + (char *)"(Y == 2)",14); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); __gmpz_clear((__mpz_struct *)(e_acsl_4)); @@ -662,7 +845,8 @@ void h(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)2); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(X == 2)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Precondition", + (char *)"(X == 2)",18); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); X ++; @@ -686,12 +870,14 @@ void i(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)3); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(X == 3)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Precondition", + (char *)"(X == 3)",22); __gmpz_init_set_si((__mpz_struct *)(e_acsl_4),(long)Y); __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)2); e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_6 == 0)) { e_acsl_fail((char *)"(Y == 2)"); } + e_acsl_assert(! (e_acsl_6 == 0),(char *)"Precondition", + (char *)"(Y == 2)",23); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); __gmpz_clear((__mpz_struct *)(e_acsl_4)); @@ -729,7 +915,8 @@ void j(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)5); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(X == 5)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Precondition", + (char *)"(X == 5)",28); __gmpz_init_set_si((__mpz_struct *)(e_acsl_4),(long)3); __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)Y); __gmpz_init((__mpz_struct *)(e_acsl_6)); @@ -737,11 +924,13 @@ void j(void) (__mpz_struct const *)(e_acsl_5)); e_acsl_7 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_6)); - if (! (e_acsl_7 == 0)) { e_acsl_fail((char *)"(X == 3+Y)"); } + e_acsl_assert(! (e_acsl_7 == 0),(char *)"Precondition", + (char *)"(X == 3+Y)",31); __gmpz_init_set_si((__mpz_struct *)(e_acsl_8),(long)2); e_acsl_9 = __gmpz_cmp((__mpz_struct const *)(e_acsl_5), (__mpz_struct const *)(e_acsl_8)); - if (! (e_acsl_9 == 0)) { e_acsl_fail((char *)"(Y == 2)"); } + e_acsl_assert(! (e_acsl_9 == 0),(char *)"Precondition", + (char *)"(Y == 2)",32); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); __gmpz_clear((__mpz_struct *)(e_acsl_4)); @@ -763,7 +952,8 @@ void j(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_11),(long)3); e_acsl_12 = __gmpz_cmp((__mpz_struct const *)(e_acsl_10), (__mpz_struct const *)(e_acsl_11)); - if (! (e_acsl_12 == 0)) { e_acsl_fail((char *)"(X == 3)"); } + e_acsl_assert(! (e_acsl_12 == 0),(char *)"Postcondition", + (char *)"(X == 3)",29); __gmpz_init_set_si((__mpz_struct *)(e_acsl_13),(long)Y); __gmpz_init_set_si((__mpz_struct *)(e_acsl_14),(long)1); __gmpz_init((__mpz_struct *)(e_acsl_15)); @@ -771,7 +961,8 @@ void j(void) (__mpz_struct const *)(e_acsl_14)); e_acsl_16 = __gmpz_cmp((__mpz_struct const *)(e_acsl_10), (__mpz_struct const *)(e_acsl_15)); - if (! (e_acsl_16 == 0)) { e_acsl_fail((char *)"(X == Y+1)"); } + e_acsl_assert(! (e_acsl_16 == 0),(char *)"Postcondition", + (char *)"(X == Y+1)",33); __gmpz_clear((__mpz_struct *)(e_acsl_10)); __gmpz_clear((__mpz_struct *)(e_acsl_11)); __gmpz_clear((__mpz_struct *)(e_acsl_13)); @@ -825,7 +1016,8 @@ void k(void) __gmpz_clear((__mpz_struct *)(e_acsl_4)); __gmpz_clear((__mpz_struct *)(e_acsl_5)); } - if (! e_acsl_7) { e_acsl_fail((char *)"(X == 1 ==> X == 0)"); } + e_acsl_assert(! e_acsl_7,(char *)"Precondition", + (char *)"(X == 1 ==> X == 0)",39); __gmpz_init_set_si((__mpz_struct *)(e_acsl_8),(long)3); e_acsl_9 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_8)); @@ -855,8 +1047,8 @@ void k(void) __gmpz_clear((__mpz_struct *)(e_acsl_14)); __gmpz_clear((__mpz_struct *)(e_acsl_15)); } - if (! e_acsl_17) { e_acsl_fail((char *)"(X == 3 && Y == 2 ==> X == 3)"); - } + e_acsl_assert(! e_acsl_17,(char *)"Precondition", + (char *)"(X == 3 && Y == 2 ==> X == 3)",43); e_acsl_18 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_8)); if (e_acsl_18 == 0) { @@ -894,9 +1086,8 @@ void k(void) __gmpz_clear((__mpz_struct *)(e_acsl_25)); __gmpz_clear((__mpz_struct *)(e_acsl_26)); } - if (! e_acsl_28) { - e_acsl_fail((char *)"(X == 3 && Y == 2 ==> X+Y == 5)"); - } + e_acsl_assert(! e_acsl_28,(char *)"Precondition", + (char *)"(X == 3 && Y == 2 ==> X+Y == 5)",44); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); __gmpz_clear((__mpz_struct *)(e_acsl_8)); @@ -918,7 +1109,8 @@ int l(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)2); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(Y == 2)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Assertion",(char *)"(Y == 2)", + 50); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } @@ -931,7 +1123,8 @@ int l(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)5); e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_6 == 0)) { e_acsl_fail((char *)"(X == 5)"); } + e_acsl_assert(! (e_acsl_6 == 0),(char *)"Postcondition", + (char *)"(X == 5)",48); __gmpz_clear((__mpz_struct *)(e_acsl_4)); __gmpz_clear((__mpz_struct *)(e_acsl_5)); return (X); @@ -939,6 +1132,156 @@ int l(void) } +/*@ behavior b1: + assumes X ≡ 7; + ensures X ≡ 95; + + behavior b2: + assumes X ≡ 5; + assumes Y ≡ 2; + ensures X ≡ 7; + ensures X ≡ \old(X)+Y; + + +*/ +void m(void) +{ + int e_acsl_4; + int e_acsl_16; + int e_acsl_28; + int e_acsl_30; + e_acsl_30 = X; + { + mpz_t e_acsl_21; + mpz_t e_acsl_22; + int e_acsl_23; + int e_acsl_27; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_21),(long)X); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_22),(long)5); + e_acsl_23 = __gmpz_cmp((__mpz_struct const *)(e_acsl_21), + (__mpz_struct const *)(e_acsl_22)); + if (e_acsl_23 == 0) { + mpz_t e_acsl_24; + mpz_t e_acsl_25; + int e_acsl_26; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_24),(long)Y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_25),(long)2); + e_acsl_26 = __gmpz_cmp((__mpz_struct const *)(e_acsl_24), + (__mpz_struct const *)(e_acsl_25)); + e_acsl_27 = e_acsl_26 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_24)); + __gmpz_clear((__mpz_struct *)(e_acsl_25)); + } + else { e_acsl_27 = 0; } + e_acsl_28 = e_acsl_27; + __gmpz_clear((__mpz_struct *)(e_acsl_21)); + __gmpz_clear((__mpz_struct *)(e_acsl_22)); + } + + { + mpz_t e_acsl_9; + mpz_t e_acsl_10; + int e_acsl_11; + int e_acsl_15; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_9),(long)X); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_10),(long)5); + e_acsl_11 = __gmpz_cmp((__mpz_struct const *)(e_acsl_9), + (__mpz_struct const *)(e_acsl_10)); + if (e_acsl_11 == 0) { + mpz_t e_acsl_12; + mpz_t e_acsl_13; + int e_acsl_14; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_12),(long)Y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_13),(long)2); + e_acsl_14 = __gmpz_cmp((__mpz_struct const *)(e_acsl_12), + (__mpz_struct const *)(e_acsl_13)); + e_acsl_15 = e_acsl_14 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_12)); + __gmpz_clear((__mpz_struct *)(e_acsl_13)); + } + else { e_acsl_15 = 0; } + e_acsl_16 = e_acsl_15; + __gmpz_clear((__mpz_struct *)(e_acsl_9)); + __gmpz_clear((__mpz_struct *)(e_acsl_10)); + } + + { + mpz_t e_acsl_1; + mpz_t e_acsl_2; + int e_acsl_3; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_1),(long)X); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)7); + e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), + (__mpz_struct const *)(e_acsl_2)); + e_acsl_4 = e_acsl_3 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_1)); + __gmpz_clear((__mpz_struct *)(e_acsl_2)); + } + + X += Y; + { + int e_acsl_8; + int e_acsl_20; + int e_acsl_35; + if (! e_acsl_4) { e_acsl_8 = 1; } + else { + mpz_t e_acsl_5; + mpz_t e_acsl_6; + int e_acsl_7; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)X); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_6),(long)95); + e_acsl_7 = __gmpz_cmp((__mpz_struct const *)(e_acsl_5), + (__mpz_struct const *)(e_acsl_6)); + e_acsl_8 = e_acsl_7 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_5)); + __gmpz_clear((__mpz_struct *)(e_acsl_6)); + } + e_acsl_assert(! e_acsl_8,(char *)"Postcondition", + (char *)"(\\old(X == 7) ==> X == 95)",57); + if (! e_acsl_16) { e_acsl_20 = 1; } + else { + mpz_t e_acsl_17; + mpz_t e_acsl_18; + int e_acsl_19; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_17),(long)X); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_18),(long)7); + e_acsl_19 = __gmpz_cmp((__mpz_struct const *)(e_acsl_17), + (__mpz_struct const *)(e_acsl_18)); + e_acsl_20 = e_acsl_19 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_17)); + __gmpz_clear((__mpz_struct *)(e_acsl_18)); + } + e_acsl_assert(! e_acsl_20,(char *)"Postcondition", + (char *)"(\\old(X == 5 && Y == 2) ==> X == 7)",61); + if (! e_acsl_28) { e_acsl_35 = 1; } + else { + mpz_t e_acsl_29; + mpz_t e_acsl_31; + mpz_t e_acsl_32; + mpz_t e_acsl_33; + int e_acsl_34; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_29),(long)X); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_31),(long)e_acsl_30); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_32),(long)Y); + __gmpz_init((__mpz_struct *)(e_acsl_33)); + __gmpz_add((__mpz_struct *)(e_acsl_33), + (__mpz_struct const *)(e_acsl_31), + (__mpz_struct const *)(e_acsl_32)); + e_acsl_34 = __gmpz_cmp((__mpz_struct const *)(e_acsl_29), + (__mpz_struct const *)(e_acsl_33)); + e_acsl_35 = e_acsl_34 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_29)); + __gmpz_clear((__mpz_struct *)(e_acsl_31)); + __gmpz_clear((__mpz_struct *)(e_acsl_32)); + __gmpz_clear((__mpz_struct *)(e_acsl_33)); + } + e_acsl_assert(! e_acsl_35,(char *)"Postcondition", + (char *)"(\\old(X == 5 && Y == 2) ==> X == \\old(X)+Y)",62); + return; + } + +} + int main(void) { int __retres; @@ -949,6 +1292,7 @@ int main(void) j(); k(); l(); + m(); __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_addrOf.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_addrOf.c index 41ece2d75938588fdd9444592fca1f0966749368..bc5e7cf96a34682a2f57e46970b6107d203f2b2e 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_addrOf.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_addrOf.c @@ -5,10 +5,13 @@ extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -18,7 +21,7 @@ int main(void) int x; x = 0; /*@ assert &x ≡ &x; */ ; - if (! (& x == & x)) { e_acsl_fail((char *)"(&x == &x)"); } + e_acsl_assert(! (& x == & x),(char *)"Assertion",(char *)"(&x == &x)",7); __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_arith.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_arith.c index a5d5ff035ff4a4f6cbf0d522bace48a768408f45..efdd5a11cce7e118a40bcd0579233136612912a0 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_arith.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_arith.c @@ -79,10 +79,13 @@ extern long __gmpz_get_si(__mpz_struct const * /*[1]*/ z); extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -106,7 +109,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_3),(long)x); e_acsl_4 = __gmpz_cmp((__mpz_struct const *)(e_acsl_2), (__mpz_struct const *)(e_acsl_3)); - if (! (e_acsl_4 == 0)) { e_acsl_fail((char *)"(-3 == x)"); } + e_acsl_assert(! (e_acsl_4 == 0),(char *)"Assertion",(char *)"(-3 == x)", + 11); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); __gmpz_clear((__mpz_struct *)(e_acsl_3)); @@ -124,7 +128,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_7),(__mpz_struct const *)(e_acsl_6)); e_acsl_8 = __gmpz_cmp((__mpz_struct const *)(e_acsl_5), (__mpz_struct const *)(e_acsl_7)); - if (! (e_acsl_8 == 0)) { e_acsl_fail((char *)"(x == -3)"); } + e_acsl_assert(! (e_acsl_8 == 0),(char *)"Assertion",(char *)"(x == -3)", + 12); __gmpz_clear((__mpz_struct *)(e_acsl_5)); __gmpz_clear((__mpz_struct *)(e_acsl_6)); __gmpz_clear((__mpz_struct *)(e_acsl_7)); @@ -140,7 +145,8 @@ int main(void) __gmpz_com(e_acsl_10,e_acsl_9); e_acsl_11 = __gmpz_cmp((__mpz_struct const *)(e_acsl_9), (__mpz_struct const *)(e_acsl_10)); - if (! (e_acsl_11 != 0)) { e_acsl_fail((char *)"(0 != ~0)"); } + e_acsl_assert(! (e_acsl_11 != 0),(char *)"Assertion",(char *)"(0 != ~0)", + 13); __gmpz_clear((__mpz_struct *)(e_acsl_9)); __gmpz_clear((__mpz_struct *)(e_acsl_10)); } @@ -163,7 +169,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_16),(__mpz_struct const *)(e_acsl_15)); e_acsl_17 = __gmpz_cmp((__mpz_struct const *)(e_acsl_14), (__mpz_struct const *)(e_acsl_16)); - if (! (e_acsl_17 == 0)) { e_acsl_fail((char *)"(x+1 == -2)"); } + e_acsl_assert(! (e_acsl_17 == 0),(char *)"Assertion", + (char *)"(x+1 == -2)",15); __gmpz_clear((__mpz_struct *)(e_acsl_12)); __gmpz_clear((__mpz_struct *)(e_acsl_13)); __gmpz_clear((__mpz_struct *)(e_acsl_14)); @@ -189,7 +196,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_22),(__mpz_struct const *)(e_acsl_21)); e_acsl_23 = __gmpz_cmp((__mpz_struct const *)(e_acsl_20), (__mpz_struct const *)(e_acsl_22)); - if (! (e_acsl_23 == 0)) { e_acsl_fail((char *)"(x-1 == -4)"); } + e_acsl_assert(! (e_acsl_23 == 0),(char *)"Assertion", + (char *)"(x-1 == -4)",16); __gmpz_clear((__mpz_struct *)(e_acsl_18)); __gmpz_clear((__mpz_struct *)(e_acsl_19)); __gmpz_clear((__mpz_struct *)(e_acsl_20)); @@ -215,7 +223,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_28),(__mpz_struct const *)(e_acsl_27)); e_acsl_29 = __gmpz_cmp((__mpz_struct const *)(e_acsl_26), (__mpz_struct const *)(e_acsl_28)); - if (! (e_acsl_29 == 0)) { e_acsl_fail((char *)"(x*3 == -9)"); } + e_acsl_assert(! (e_acsl_29 == 0),(char *)"Assertion", + (char *)"(x*3 == -9)",17); __gmpz_clear((__mpz_struct *)(e_acsl_24)); __gmpz_clear((__mpz_struct *)(e_acsl_25)); __gmpz_clear((__mpz_struct *)(e_acsl_26)); @@ -237,7 +246,7 @@ int main(void) e_acsl_32 = (int)__gmpz_get_si((__mpz_struct const *)(e_acsl_31)); __gmpz_init((__mpz_struct *)(e_acsl_33)); /*@ assert 3 ≢ 0; */ ; - if (e_acsl_32 == 0) { e_acsl_fail((char *)"(3 == 0)"); } + e_acsl_assert(e_acsl_32 == 0,(char *)"Assertion",(char *)"(3 == 0)",18); __gmpz_tdiv_q((__mpz_struct *)(e_acsl_33), (__mpz_struct const *)(e_acsl_30), (__mpz_struct const *)(e_acsl_31)); @@ -246,7 +255,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_35),(__mpz_struct const *)(e_acsl_34)); e_acsl_36 = __gmpz_cmp((__mpz_struct const *)(e_acsl_33), (__mpz_struct const *)(e_acsl_35)); - if (! (e_acsl_36 == 0)) { e_acsl_fail((char *)"(x/3 == -1)"); } + e_acsl_assert(! (e_acsl_36 == 0),(char *)"Assertion", + (char *)"(x/3 == -1)",18); __gmpz_clear((__mpz_struct *)(e_acsl_30)); __gmpz_clear((__mpz_struct *)(e_acsl_31)); __gmpz_clear((__mpz_struct *)(e_acsl_33)); @@ -268,16 +278,16 @@ int main(void) (__mpz_struct const *)(e_acsl_38)); __gmpz_init((__mpz_struct *)(e_acsl_40)); /*@ assert 0xfffffffffff ≢ 0; */ ; - if (e_acsl_39 == 0) { e_acsl_fail((char *)"(0xfffffffffff == 0)"); } + e_acsl_assert(e_acsl_39 == 0,(char *)"Assertion", + (char *)"(0xfffffffffff == 0)",19); __gmpz_tdiv_q((__mpz_struct *)(e_acsl_40), (__mpz_struct const *)(e_acsl_37), (__mpz_struct const *)(e_acsl_37)); __gmpz_init_set_si((__mpz_struct *)(e_acsl_41),(long)1); e_acsl_42 = __gmpz_cmp((__mpz_struct const *)(e_acsl_40), (__mpz_struct const *)(e_acsl_41)); - if (! (e_acsl_42 == 0)) { - e_acsl_fail((char *)"(0xfffffffffff/0xfffffffffff == 1)"); - } + e_acsl_assert(! (e_acsl_42 == 0),(char *)"Assertion", + (char *)"(0xfffffffffff/0xfffffffffff == 1)",19); __gmpz_clear((__mpz_struct *)(e_acsl_37)); __gmpz_clear((__mpz_struct *)(e_acsl_38)); __gmpz_clear((__mpz_struct *)(e_acsl_40)); @@ -298,7 +308,7 @@ int main(void) e_acsl_45 = (int)__gmpz_get_si((__mpz_struct const *)(e_acsl_44)); __gmpz_init((__mpz_struct *)(e_acsl_46)); /*@ assert 2 ≢ 0; */ ; - if (e_acsl_45 == 0) { e_acsl_fail((char *)"(2 == 0)"); } + e_acsl_assert(e_acsl_45 == 0,(char *)"Assertion",(char *)"(2 == 0)",20); __gmpz_tdiv_r((__mpz_struct *)(e_acsl_46), (__mpz_struct const *)(e_acsl_43), (__mpz_struct const *)(e_acsl_44)); @@ -307,7 +317,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_48),(__mpz_struct const *)(e_acsl_47)); e_acsl_49 = __gmpz_cmp((__mpz_struct const *)(e_acsl_46), (__mpz_struct const *)(e_acsl_48)); - if (! (e_acsl_49 == 0)) { e_acsl_fail((char *)"(x%2 == -1)"); } + e_acsl_assert(! (e_acsl_49 == 0),(char *)"Assertion", + (char *)"(x%2 == -1)",20); __gmpz_clear((__mpz_struct *)(e_acsl_43)); __gmpz_clear((__mpz_struct *)(e_acsl_44)); __gmpz_clear((__mpz_struct *)(e_acsl_46)); @@ -338,7 +349,7 @@ int main(void) (__mpz_struct const *)(e_acsl_54)); __gmpz_init((__mpz_struct *)(e_acsl_56)); /*@ assert -2 ≢ 0; */ ; - if (e_acsl_55 == 0) { e_acsl_fail((char *)"(-2 == 0)"); } + e_acsl_assert(e_acsl_55 == 0,(char *)"Assertion",(char *)"(-2 == 0)",21); __gmpz_tdiv_r((__mpz_struct *)(e_acsl_56), (__mpz_struct const *)(e_acsl_51), (__mpz_struct const *)(e_acsl_53)); @@ -347,7 +358,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_58),(__mpz_struct const *)(e_acsl_57)); e_acsl_59 = __gmpz_cmp((__mpz_struct const *)(e_acsl_56), (__mpz_struct const *)(e_acsl_58)); - if (! (e_acsl_59 == 0)) { e_acsl_fail((char *)"(-3%-2 == -1)"); } + e_acsl_assert(! (e_acsl_59 == 0),(char *)"Assertion", + (char *)"(-3%-2 == -1)",21); __gmpz_clear((__mpz_struct *)(e_acsl_50)); __gmpz_clear((__mpz_struct *)(e_acsl_51)); __gmpz_clear((__mpz_struct *)(e_acsl_52)); @@ -377,14 +389,15 @@ int main(void) (__mpz_struct const *)(e_acsl_63)); __gmpz_init((__mpz_struct *)(e_acsl_65)); /*@ assert -2 ≢ 0; */ ; - if (e_acsl_64 == 0) { e_acsl_fail((char *)"(-2 == 0)"); } + e_acsl_assert(e_acsl_64 == 0,(char *)"Assertion",(char *)"(-2 == 0)",22); __gmpz_tdiv_r((__mpz_struct *)(e_acsl_65), (__mpz_struct const *)(e_acsl_60), (__mpz_struct const *)(e_acsl_62)); __gmpz_init_set_si((__mpz_struct *)(e_acsl_66),(long)1); e_acsl_67 = __gmpz_cmp((__mpz_struct const *)(e_acsl_65), (__mpz_struct const *)(e_acsl_66)); - if (! (e_acsl_67 == 0)) { e_acsl_fail((char *)"(3%-2 == 1)"); } + e_acsl_assert(! (e_acsl_67 == 0),(char *)"Assertion", + (char *)"(3%-2 == 1)",22); __gmpz_clear((__mpz_struct *)(e_acsl_60)); __gmpz_clear((__mpz_struct *)(e_acsl_61)); __gmpz_clear((__mpz_struct *)(e_acsl_62)); @@ -437,9 +450,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_80),(__mpz_struct const *)(e_acsl_79)); e_acsl_81 = __gmpz_cmp((__mpz_struct const *)(e_acsl_78), (__mpz_struct const *)(e_acsl_80)); - if (! (e_acsl_81 == 0)) { - e_acsl_fail((char *)"(((x*2+(3+y))-4)+(x-y) == -10)"); - } + e_acsl_assert(! (e_acsl_81 == 0),(char *)"Assertion", + (char *)"(((x*2+(3+y))-4)+(x-y) == -10)",24); __gmpz_clear((__mpz_struct *)(e_acsl_68)); __gmpz_clear((__mpz_struct *)(e_acsl_69)); __gmpz_clear((__mpz_struct *)(e_acsl_70)); @@ -456,9 +468,8 @@ int main(void) } /*@ assert (0≡1) ≡ !(0≡0); */ ; - if (! ((0 == 1) == ! (0 == 0))) { - e_acsl_fail((char *)"((0==1) == !(0==0))"); - } + e_acsl_assert(! ((0 == 1) == ! (0 == 0)),(char *)"Assertion", + (char *)"((0==1) == !(0==0))",26); /*@ assert (0≤-1) ≡ (0>0); */ ; { mpz_t e_acsl_82; @@ -471,9 +482,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_84),(__mpz_struct const *)(e_acsl_83)); e_acsl_85 = __gmpz_cmp((__mpz_struct const *)(e_acsl_82), (__mpz_struct const *)(e_acsl_84)); - if (! ((e_acsl_85 <= 0) == (0 > 0))) { - e_acsl_fail((char *)"((0<=-1) == (0>0))"); - } + e_acsl_assert(! ((e_acsl_85 <= 0) == (0 > 0)),(char *)"Assertion", + (char *)"((0<=-1) == (0>0))",27); __gmpz_clear((__mpz_struct *)(e_acsl_82)); __gmpz_clear((__mpz_struct *)(e_acsl_83)); __gmpz_clear((__mpz_struct *)(e_acsl_84)); @@ -491,22 +501,19 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_88),(__mpz_struct const *)(e_acsl_87)); e_acsl_89 = __gmpz_cmp((__mpz_struct const *)(e_acsl_86), (__mpz_struct const *)(e_acsl_88)); - if (! ((e_acsl_89 >= 0) == (0 <= 0))) { - e_acsl_fail((char *)"((0>=-1) == (0<=0))"); - } + e_acsl_assert(! ((e_acsl_89 >= 0) == (0 <= 0)),(char *)"Assertion", + (char *)"((0>=-1) == (0<=0))",28); __gmpz_clear((__mpz_struct *)(e_acsl_86)); __gmpz_clear((__mpz_struct *)(e_acsl_87)); __gmpz_clear((__mpz_struct *)(e_acsl_88)); } /*@ assert (0≢1) ≡ !(0≢0); */ ; - if (! ((0 != 1) == ! (0 != 0))) { - e_acsl_fail((char *)"((0!=1) == !(0!=0))"); - } + e_acsl_assert(! ((0 != 1) == ! (0 != 0)),(char *)"Assertion", + (char *)"((0!=1) == !(0!=0))",29); /*@ assert (0≢0) ≡ !(1≢0); */ ; - if (! ((0 != 0) == ! (1 != 0))) { - e_acsl_fail((char *)"((0!=0) == !(1!=0))"); - } + e_acsl_assert(! ((0 != 0) == ! (1 != 0)),(char *)"Assertion", + (char *)"((0!=0) == !(1!=0))",31); __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_array.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_array.c index bc099e27cecbbf09e3996f6af35709310339a71e..42082331ac40b71eb583cc9c34f80be75f5b3cba 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_array.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_array.c @@ -5,10 +5,13 @@ extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -34,9 +37,11 @@ int main(void) } /*@ assert T1[0] ≡ T2[0]; */ ; - if (! (T1[0] == T2[0])) { e_acsl_fail((char *)"(T1[0] == T2[0])"); } + e_acsl_assert(! (T1[0] == T2[0]),(char *)"Assertion", + (char *)"(T1[0] == T2[0])",13); /*@ assert T1[1] ≢ T2[1]; */ ; - if (! (T1[1] != T2[1])) { e_acsl_fail((char *)"(T1[1] != T2[1])"); } + e_acsl_assert(! (T1[1] != T2[1]),(char *)"Assertion", + (char *)"(T1[1] != T2[1])",14); __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_at.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_at.c index 3c8f1eefdaf931da65cdabc7f021352ecee4baf8..e13447daf6595f77ec10b802d548c0acbb5f7607 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_at.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_at.c @@ -40,10 +40,13 @@ extern void __gmpz_add(__mpz_struct * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -72,7 +75,8 @@ void f(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_3),(long)0); e_acsl_4 = __gmpz_cmp((__mpz_struct const *)(e_acsl_2), (__mpz_struct const *)(e_acsl_3)); - if (! (e_acsl_4 == 0)) { e_acsl_fail((char *)"(\\at(A,Pre) == 0)"); } + e_acsl_assert(! (e_acsl_4 == 0),(char *)"Assertion", + (char *)"(\\at(A,Pre) == 0)",12); __gmpz_clear((__mpz_struct *)(e_acsl_2)); __gmpz_clear((__mpz_struct *)(e_acsl_3)); } @@ -86,7 +90,8 @@ void f(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_7),(long)1); e_acsl_8 = __gmpz_cmp((__mpz_struct const *)(e_acsl_6), (__mpz_struct const *)(e_acsl_7)); - if (! (e_acsl_8 == 0)) { e_acsl_fail((char *)"(\\at(A,F) == 1)"); } + e_acsl_assert(! (e_acsl_8 == 0),(char *)"Assertion", + (char *)"(\\at(A,F) == 1)",13); __gmpz_clear((__mpz_struct *)(e_acsl_6)); __gmpz_clear((__mpz_struct *)(e_acsl_7)); } @@ -101,7 +106,8 @@ void f(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_11),(long)2); e_acsl_12 = __gmpz_cmp((__mpz_struct const *)(e_acsl_10), (__mpz_struct const *)(e_acsl_11)); - if (! (e_acsl_12 == 0)) { e_acsl_fail((char *)"(\\at(A,Here) == 2)"); } + e_acsl_assert(! (e_acsl_12 == 0),(char *)"Assertion", + (char *)"(\\at(A,Here) == 2)",14); __gmpz_clear((__mpz_struct *)(e_acsl_10)); __gmpz_clear((__mpz_struct *)(e_acsl_11)); } @@ -115,9 +121,8 @@ void f(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_16),(long)0); e_acsl_17 = __gmpz_cmp((__mpz_struct const *)(e_acsl_15), (__mpz_struct const *)(e_acsl_16)); - if (! (e_acsl_17 == 0)) { - e_acsl_fail((char *)"(\\at(\\at(A,Pre),F) == 0)"); - } + e_acsl_assert(! (e_acsl_17 == 0),(char *)"Assertion", + (char *)"(\\at(\\at(A,Pre),F) == 0)",15); __gmpz_clear((__mpz_struct *)(e_acsl_15)); __gmpz_clear((__mpz_struct *)(e_acsl_16)); } @@ -132,7 +137,8 @@ void f(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_20),(long)3); e_acsl_21 = __gmpz_cmp((__mpz_struct const *)(e_acsl_19), (__mpz_struct const *)(e_acsl_20)); - if (! (e_acsl_21 == 0)) { e_acsl_fail((char *)"(\\at(A,Post) == 3)"); } + e_acsl_assert(! (e_acsl_21 == 0),(char *)"Postcondition", + (char *)"(\\at(A,Post) == 3)",8); __gmpz_clear((__mpz_struct *)(e_acsl_19)); __gmpz_clear((__mpz_struct *)(e_acsl_20)); return; @@ -165,9 +171,8 @@ void g(int *p, int *q) __gmpz_init_set_si((__mpz_struct *)(e_acsl_4),(long)2); e_acsl_5 = __gmpz_cmp((__mpz_struct const *)(e_acsl_3), (__mpz_struct const *)(e_acsl_4)); - if (! (e_acsl_5 == 0)) { - e_acsl_fail((char *)"(\\at(*(p+\\at(*q,L1)),L2) == 2)"); - } + e_acsl_assert(! (e_acsl_5 == 0),(char *)"Assertion", + (char *)"(\\at(*(p+\\at(*q,L1)),L2) == 2)",31); __gmpz_clear((__mpz_struct *)(e_acsl_3)); __gmpz_clear((__mpz_struct *)(e_acsl_4)); } @@ -183,9 +188,8 @@ void g(int *p, int *q) __gmpz_init_set_si((__mpz_struct *)(e_acsl_9),(long)2); e_acsl_10 = __gmpz_cmp((__mpz_struct const *)(e_acsl_8), (__mpz_struct const *)(e_acsl_9)); - if (! (e_acsl_10 == 0)) { - e_acsl_fail((char *)"(\\at(*(p+\\at(*q,L1)),Here) == 2)"); - } + e_acsl_assert(! (e_acsl_10 == 0),(char *)"Assertion", + (char *)"(\\at(*(p+\\at(*q,L1)),Here) == 2)",33); __gmpz_clear((__mpz_struct *)(e_acsl_8)); __gmpz_clear((__mpz_struct *)(e_acsl_9)); } @@ -229,7 +233,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)0); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(x == 0)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Assertion",(char *)"(x == 0)", + 44); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } @@ -246,7 +251,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_6),(long)0); e_acsl_7 = __gmpz_cmp((__mpz_struct const *)(e_acsl_5), (__mpz_struct const *)(e_acsl_6)); - if (! (e_acsl_7 == 0)) { e_acsl_fail((char *)"(\\at(x,L) == 0)"); } + e_acsl_assert(! (e_acsl_7 == 0),(char *)"Assertion", + (char *)"(\\at(x,L) == 0)",49); __gmpz_clear((__mpz_struct *)(e_acsl_5)); __gmpz_clear((__mpz_struct *)(e_acsl_6)); } @@ -258,7 +264,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_12),(long)1); e_acsl_13 = __gmpz_cmp((__mpz_struct const *)(e_acsl_11), (__mpz_struct const *)(e_acsl_12)); - if (! (e_acsl_13 == 0)) { e_acsl_fail((char *)"(\\at(x+1,L) == 1)"); } + e_acsl_assert(! (e_acsl_13 == 0),(char *)"Assertion", + (char *)"(\\at(x+1,L) == 1)",50); __gmpz_clear((__mpz_struct *)(e_acsl_12)); } @@ -275,7 +282,8 @@ int main(void) (__mpz_struct const *)(e_acsl_16)); e_acsl_18 = __gmpz_cmp((__mpz_struct const *)(e_acsl_17), (__mpz_struct const *)(e_acsl_16)); - if (! (e_acsl_18 == 0)) { e_acsl_fail((char *)"(\\at(x,L)+1 == 1)"); } + e_acsl_assert(! (e_acsl_18 == 0),(char *)"Assertion", + (char *)"(\\at(x,L)+1 == 1)",51); __gmpz_clear((__mpz_struct *)(e_acsl_15)); __gmpz_clear((__mpz_struct *)(e_acsl_16)); __gmpz_clear((__mpz_struct *)(e_acsl_17)); diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_cast.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_cast.c index 43b8b8d91c193b3ed3333ec5e1ff0f9566c0948a..decd458f885a5ce572e4b4aad2043711c7bdbef3 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_cast.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_cast.c @@ -25,10 +25,13 @@ extern unsigned long __gmpz_get_ui(__mpz_struct const * /*[1]*/ z); extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -45,9 +48,8 @@ int main(void) int e_acsl_2; __gmpz_init_set_str((__mpz_struct *)(e_acsl_1),"1152921504606846975",10); e_acsl_2 = (int)__gmpz_get_si((__mpz_struct const *)(e_acsl_1)); - if (! (y != e_acsl_2)) { - e_acsl_fail((char *)"(y != (int)0xfffffffffffffff)"); - } + e_acsl_assert(! (y != e_acsl_2),(char *)"Assertion", + (char *)"(y != (int)0xfffffffffffffff)",17); __gmpz_clear((__mpz_struct *)(e_acsl_1)); } @@ -57,9 +59,9 @@ int main(void) unsigned int e_acsl_4; __gmpz_init_set_str((__mpz_struct *)(e_acsl_3),"1152921504606846975",10); e_acsl_4 = (unsigned int)__gmpz_get_ui((__mpz_struct const *)(e_acsl_3)); - if (! ((unsigned int)y != e_acsl_4)) { - e_acsl_fail((char *)"((unsigned int)y != (unsigned int)0xfffffffffffffff)"); - } + e_acsl_assert(! ((unsigned int)y != e_acsl_4),(char *)"Assertion", + (char *)"((unsigned int)y != (unsigned int)0xfffffffffffffff)", + 18); __gmpz_clear((__mpz_struct *)(e_acsl_3)); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_comparison.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_comparison.c index 1f8f8bb40e520686e817f7c55a60e9dd33a7c77f..cec63627c005211ce29851074335f867486ea3d3 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_comparison.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_comparison.c @@ -32,10 +32,13 @@ extern void __gmpz_neg(__mpz_struct * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -48,9 +51,9 @@ int main(void) x = 0; y = 1; /*@ assert x < y; */ ; - if (! (x < y)) { e_acsl_fail((char *)"(x < y)"); } + e_acsl_assert(! (x < y),(char *)"Assertion",(char *)"(x < y)",8); /*@ assert y > x; */ ; - if (! (y > x)) { e_acsl_fail((char *)"(y > x)"); } + e_acsl_assert(! (y > x),(char *)"Assertion",(char *)"(y > x)",9); /*@ assert x ≤ 0; */ ; { mpz_t e_acsl_1; @@ -60,7 +63,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)0); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 <= 0)) { e_acsl_fail((char *)"(x <= 0)"); } + e_acsl_assert(! (e_acsl_3 <= 0),(char *)"Assertion",(char *)"(x <= 0)", + 10); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } @@ -74,29 +78,31 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)1); e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_6 >= 0)) { e_acsl_fail((char *)"(y >= 1)"); } + e_acsl_assert(! (e_acsl_6 >= 0),(char *)"Assertion",(char *)"(y >= 1)", + 11); __gmpz_clear((__mpz_struct *)(e_acsl_4)); __gmpz_clear((__mpz_struct *)(e_acsl_5)); } s = (char *)"toto"; /*@ assert s ≡ s; */ ; - if (! (s == s)) { e_acsl_fail((char *)"(s == s)"); } + e_acsl_assert(! (s == s),(char *)"Assertion",(char *)"(s == s)",13); /*@ assert "toto" ≢ "titi"; */ ; - if (! ("toto" != "titi")) { e_acsl_fail((char *)"(\"toto\" != \"titi\")"); - } + e_acsl_assert(! ("toto" != "titi"),(char *)"Assertion", + (char *)"(\"toto\" != \"titi\")",14); /*@ assert 5 < 18; */ ; - if (! (5 < 18)) { e_acsl_fail((char *)"(5 < 18)"); } + e_acsl_assert(! (5 < 18),(char *)"Assertion",(char *)"(5 < 18)",15); /*@ assert 32 > 3; */ ; - if (! (32 > 3)) { e_acsl_fail((char *)"(32 > 3)"); } + e_acsl_assert(! (32 > 3),(char *)"Assertion",(char *)"(32 > 3)",16); /*@ assert 12 ≤ 13; */ ; - if (! (12 <= 13)) { e_acsl_fail((char *)"(12 <= 13)"); } + e_acsl_assert(! (12 <= 13),(char *)"Assertion",(char *)"(12 <= 13)",17); /*@ assert 123 ≥ 12; */ ; - if (! (123 >= 12)) { e_acsl_fail((char *)"(123 >= 12)"); } + e_acsl_assert(! (123 >= 12),(char *)"Assertion",(char *)"(123 >= 12)",18); /*@ assert 0xff ≡ 0xff; */ ; - if (! (0xff == 0xff)) { e_acsl_fail((char *)"(0xff == 0xff)"); } + e_acsl_assert(! (0xff == 0xff),(char *)"Assertion", + (char *)"(0xff == 0xff)",19); /*@ assert 1 ≢ 2; */ ; - if (! (1 != 2)) { e_acsl_fail((char *)"(1 != 2)"); } + e_acsl_assert(! (1 != 2),(char *)"Assertion",(char *)"(1 != 2)",20); /*@ assert -5 < 18; */ ; { mpz_t e_acsl_7; @@ -109,7 +115,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_9),(long)18); e_acsl_10 = __gmpz_cmp((__mpz_struct const *)(e_acsl_8), (__mpz_struct const *)(e_acsl_9)); - if (! (e_acsl_10 < 0)) { e_acsl_fail((char *)"(-5 < 18)"); } + e_acsl_assert(! (e_acsl_10 < 0),(char *)"Assertion",(char *)"(-5 < 18)", + 22); __gmpz_clear((__mpz_struct *)(e_acsl_7)); __gmpz_clear((__mpz_struct *)(e_acsl_8)); __gmpz_clear((__mpz_struct *)(e_acsl_9)); @@ -127,7 +134,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_13),(__mpz_struct const *)(e_acsl_12)); e_acsl_14 = __gmpz_cmp((__mpz_struct const *)(e_acsl_11), (__mpz_struct const *)(e_acsl_13)); - if (! (e_acsl_14 > 0)) { e_acsl_fail((char *)"(32 > -3)"); } + e_acsl_assert(! (e_acsl_14 > 0),(char *)"Assertion",(char *)"(32 > -3)", + 23); __gmpz_clear((__mpz_struct *)(e_acsl_11)); __gmpz_clear((__mpz_struct *)(e_acsl_12)); __gmpz_clear((__mpz_struct *)(e_acsl_13)); @@ -145,7 +153,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_17),(long)13); e_acsl_18 = __gmpz_cmp((__mpz_struct const *)(e_acsl_16), (__mpz_struct const *)(e_acsl_17)); - if (! (e_acsl_18 <= 0)) { e_acsl_fail((char *)"(-12 <= 13)"); } + e_acsl_assert(! (e_acsl_18 <= 0),(char *)"Assertion", + (char *)"(-12 <= 13)",24); __gmpz_clear((__mpz_struct *)(e_acsl_15)); __gmpz_clear((__mpz_struct *)(e_acsl_16)); __gmpz_clear((__mpz_struct *)(e_acsl_17)); @@ -163,7 +172,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_21),(__mpz_struct const *)(e_acsl_20)); e_acsl_22 = __gmpz_cmp((__mpz_struct const *)(e_acsl_19), (__mpz_struct const *)(e_acsl_21)); - if (! (e_acsl_22 >= 0)) { e_acsl_fail((char *)"(123 >= -12)"); } + e_acsl_assert(! (e_acsl_22 >= 0),(char *)"Assertion", + (char *)"(123 >= -12)",25); __gmpz_clear((__mpz_struct *)(e_acsl_19)); __gmpz_clear((__mpz_struct *)(e_acsl_20)); __gmpz_clear((__mpz_struct *)(e_acsl_21)); @@ -179,7 +189,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_24),(__mpz_struct const *)(e_acsl_23)); e_acsl_25 = __gmpz_cmp((__mpz_struct const *)(e_acsl_24), (__mpz_struct const *)(e_acsl_24)); - if (! (e_acsl_25 == 0)) { e_acsl_fail((char *)"(-0xff == -0xff)"); } + e_acsl_assert(! (e_acsl_25 == 0),(char *)"Assertion", + (char *)"(-0xff == -0xff)",26); __gmpz_clear((__mpz_struct *)(e_acsl_23)); __gmpz_clear((__mpz_struct *)(e_acsl_24)); } @@ -196,7 +207,8 @@ int main(void) __gmpz_neg((__mpz_struct *)(e_acsl_28),(__mpz_struct const *)(e_acsl_27)); e_acsl_29 = __gmpz_cmp((__mpz_struct const *)(e_acsl_26), (__mpz_struct const *)(e_acsl_28)); - if (! (e_acsl_29 != 0)) { e_acsl_fail((char *)"(1 != -2)"); } + e_acsl_assert(! (e_acsl_29 != 0),(char *)"Assertion",(char *)"(1 != -2)", + 27); __gmpz_clear((__mpz_struct *)(e_acsl_26)); __gmpz_clear((__mpz_struct *)(e_acsl_27)); __gmpz_clear((__mpz_struct *)(e_acsl_28)); diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_false.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_false.c index b6e10ed22858f8e0b1645db704ca2634272f9258..0768cf6db901b334d26172954860b7ff04c868b3 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_false.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_false.c @@ -5,10 +5,13 @@ extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -19,7 +22,8 @@ int main(void) x = 0; if (x) { /*@ assert \false; */ ; - e_acsl_fail((char *)"(\\false)"); } + e_acsl_assert(1,(char *)"Assertion",(char *)"(\\false)",7); + } __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_function_contract.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_function_contract.c index 84f0c414e6641eb1a07e57f6ce66eeae5d0febf2..87e9670420ccda613afb64927545a0707f83c592 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_function_contract.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_function_contract.c @@ -35,10 +35,13 @@ extern void __gmpz_add(__mpz_struct * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -56,7 +59,8 @@ void f(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)1); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(X == 1)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Postcondition", + (char *)"(X == 1)",9); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); return; @@ -79,11 +83,13 @@ void g(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)2); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(X == 2)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Postcondition", + (char *)"(X == 2)",13); __gmpz_init_set_si((__mpz_struct *)(e_acsl_4),(long)Y); e_acsl_5 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_5 == 0)) { e_acsl_fail((char *)"(Y == 2)"); } + e_acsl_assert(! (e_acsl_5 == 0),(char *)"Postcondition", + (char *)"(Y == 2)",14); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); __gmpz_clear((__mpz_struct *)(e_acsl_4)); @@ -103,7 +109,8 @@ void h(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)2); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(X == 2)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Precondition", + (char *)"(X == 2)",18); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); X ++; @@ -127,12 +134,14 @@ void i(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)3); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(X == 3)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Precondition", + (char *)"(X == 3)",22); __gmpz_init_set_si((__mpz_struct *)(e_acsl_4),(long)Y); __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)2); e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_6 == 0)) { e_acsl_fail((char *)"(Y == 2)"); } + e_acsl_assert(! (e_acsl_6 == 0),(char *)"Precondition", + (char *)"(Y == 2)",23); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); __gmpz_clear((__mpz_struct *)(e_acsl_4)); @@ -170,7 +179,8 @@ void j(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)5); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(X == 5)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Precondition", + (char *)"(X == 5)",28); __gmpz_init_set_si((__mpz_struct *)(e_acsl_4),(long)3); __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)Y); __gmpz_init((__mpz_struct *)(e_acsl_6)); @@ -178,11 +188,13 @@ void j(void) (__mpz_struct const *)(e_acsl_5)); e_acsl_7 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_6)); - if (! (e_acsl_7 == 0)) { e_acsl_fail((char *)"(X == 3+Y)"); } + e_acsl_assert(! (e_acsl_7 == 0),(char *)"Precondition", + (char *)"(X == 3+Y)",31); __gmpz_init_set_si((__mpz_struct *)(e_acsl_8),(long)2); e_acsl_9 = __gmpz_cmp((__mpz_struct const *)(e_acsl_5), (__mpz_struct const *)(e_acsl_8)); - if (! (e_acsl_9 == 0)) { e_acsl_fail((char *)"(Y == 2)"); } + e_acsl_assert(! (e_acsl_9 == 0),(char *)"Precondition", + (char *)"(Y == 2)",32); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); __gmpz_clear((__mpz_struct *)(e_acsl_4)); @@ -204,7 +216,8 @@ void j(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_11),(long)3); e_acsl_12 = __gmpz_cmp((__mpz_struct const *)(e_acsl_10), (__mpz_struct const *)(e_acsl_11)); - if (! (e_acsl_12 == 0)) { e_acsl_fail((char *)"(X == 3)"); } + e_acsl_assert(! (e_acsl_12 == 0),(char *)"Postcondition", + (char *)"(X == 3)",29); __gmpz_init_set_si((__mpz_struct *)(e_acsl_13),(long)Y); __gmpz_init_set_si((__mpz_struct *)(e_acsl_14),(long)1); __gmpz_init((__mpz_struct *)(e_acsl_15)); @@ -212,7 +225,8 @@ void j(void) (__mpz_struct const *)(e_acsl_14)); e_acsl_16 = __gmpz_cmp((__mpz_struct const *)(e_acsl_10), (__mpz_struct const *)(e_acsl_15)); - if (! (e_acsl_16 == 0)) { e_acsl_fail((char *)"(X == Y+1)"); } + e_acsl_assert(! (e_acsl_16 == 0),(char *)"Postcondition", + (char *)"(X == Y+1)",33); __gmpz_clear((__mpz_struct *)(e_acsl_10)); __gmpz_clear((__mpz_struct *)(e_acsl_11)); __gmpz_clear((__mpz_struct *)(e_acsl_13)); @@ -266,7 +280,8 @@ void k(void) __gmpz_clear((__mpz_struct *)(e_acsl_4)); __gmpz_clear((__mpz_struct *)(e_acsl_5)); } - if (! e_acsl_7) { e_acsl_fail((char *)"(X == 1 ==> X == 0)"); } + e_acsl_assert(! e_acsl_7,(char *)"Precondition", + (char *)"(X == 1 ==> X == 0)",39); __gmpz_init_set_si((__mpz_struct *)(e_acsl_8),(long)3); e_acsl_9 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_8)); @@ -296,8 +311,8 @@ void k(void) __gmpz_clear((__mpz_struct *)(e_acsl_14)); __gmpz_clear((__mpz_struct *)(e_acsl_15)); } - if (! e_acsl_17) { e_acsl_fail((char *)"(X == 3 && Y == 2 ==> X == 3)"); - } + e_acsl_assert(! e_acsl_17,(char *)"Precondition", + (char *)"(X == 3 && Y == 2 ==> X == 3)",43); e_acsl_18 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_8)); if (e_acsl_18 == 0) { @@ -335,9 +350,8 @@ void k(void) __gmpz_clear((__mpz_struct *)(e_acsl_25)); __gmpz_clear((__mpz_struct *)(e_acsl_26)); } - if (! e_acsl_28) { - e_acsl_fail((char *)"(X == 3 && Y == 2 ==> X+Y == 5)"); - } + e_acsl_assert(! e_acsl_28,(char *)"Precondition", + (char *)"(X == 3 && Y == 2 ==> X+Y == 5)",44); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); __gmpz_clear((__mpz_struct *)(e_acsl_8)); @@ -359,7 +373,8 @@ int l(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)2); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(Y == 2)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Assertion",(char *)"(Y == 2)", + 50); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } @@ -372,7 +387,8 @@ int l(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)5); e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_6 == 0)) { e_acsl_fail((char *)"(X == 5)"); } + e_acsl_assert(! (e_acsl_6 == 0),(char *)"Postcondition", + (char *)"(X == 5)",48); __gmpz_clear((__mpz_struct *)(e_acsl_4)); __gmpz_clear((__mpz_struct *)(e_acsl_5)); return (X); @@ -380,6 +396,156 @@ int l(void) } +/*@ behavior b1: + assumes X ≡ 7; + ensures X ≡ 95; + + behavior b2: + assumes X ≡ 5; + assumes Y ≡ 2; + ensures X ≡ 7; + ensures X ≡ \old(X)+Y; + + +*/ +void m(void) +{ + int e_acsl_4; + int e_acsl_16; + int e_acsl_28; + int e_acsl_30; + e_acsl_30 = X; + { + mpz_t e_acsl_21; + mpz_t e_acsl_22; + int e_acsl_23; + int e_acsl_27; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_21),(long)X); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_22),(long)5); + e_acsl_23 = __gmpz_cmp((__mpz_struct const *)(e_acsl_21), + (__mpz_struct const *)(e_acsl_22)); + if (e_acsl_23 == 0) { + mpz_t e_acsl_24; + mpz_t e_acsl_25; + int e_acsl_26; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_24),(long)Y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_25),(long)2); + e_acsl_26 = __gmpz_cmp((__mpz_struct const *)(e_acsl_24), + (__mpz_struct const *)(e_acsl_25)); + e_acsl_27 = e_acsl_26 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_24)); + __gmpz_clear((__mpz_struct *)(e_acsl_25)); + } + else { e_acsl_27 = 0; } + e_acsl_28 = e_acsl_27; + __gmpz_clear((__mpz_struct *)(e_acsl_21)); + __gmpz_clear((__mpz_struct *)(e_acsl_22)); + } + + { + mpz_t e_acsl_9; + mpz_t e_acsl_10; + int e_acsl_11; + int e_acsl_15; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_9),(long)X); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_10),(long)5); + e_acsl_11 = __gmpz_cmp((__mpz_struct const *)(e_acsl_9), + (__mpz_struct const *)(e_acsl_10)); + if (e_acsl_11 == 0) { + mpz_t e_acsl_12; + mpz_t e_acsl_13; + int e_acsl_14; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_12),(long)Y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_13),(long)2); + e_acsl_14 = __gmpz_cmp((__mpz_struct const *)(e_acsl_12), + (__mpz_struct const *)(e_acsl_13)); + e_acsl_15 = e_acsl_14 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_12)); + __gmpz_clear((__mpz_struct *)(e_acsl_13)); + } + else { e_acsl_15 = 0; } + e_acsl_16 = e_acsl_15; + __gmpz_clear((__mpz_struct *)(e_acsl_9)); + __gmpz_clear((__mpz_struct *)(e_acsl_10)); + } + + { + mpz_t e_acsl_1; + mpz_t e_acsl_2; + int e_acsl_3; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_1),(long)X); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)7); + e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), + (__mpz_struct const *)(e_acsl_2)); + e_acsl_4 = e_acsl_3 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_1)); + __gmpz_clear((__mpz_struct *)(e_acsl_2)); + } + + X += Y; + { + int e_acsl_8; + int e_acsl_20; + int e_acsl_35; + if (! e_acsl_4) { e_acsl_8 = 1; } + else { + mpz_t e_acsl_5; + mpz_t e_acsl_6; + int e_acsl_7; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)X); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_6),(long)95); + e_acsl_7 = __gmpz_cmp((__mpz_struct const *)(e_acsl_5), + (__mpz_struct const *)(e_acsl_6)); + e_acsl_8 = e_acsl_7 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_5)); + __gmpz_clear((__mpz_struct *)(e_acsl_6)); + } + e_acsl_assert(! e_acsl_8,(char *)"Postcondition", + (char *)"(\\old(X == 7) ==> X == 95)",57); + if (! e_acsl_16) { e_acsl_20 = 1; } + else { + mpz_t e_acsl_17; + mpz_t e_acsl_18; + int e_acsl_19; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_17),(long)X); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_18),(long)7); + e_acsl_19 = __gmpz_cmp((__mpz_struct const *)(e_acsl_17), + (__mpz_struct const *)(e_acsl_18)); + e_acsl_20 = e_acsl_19 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_17)); + __gmpz_clear((__mpz_struct *)(e_acsl_18)); + } + e_acsl_assert(! e_acsl_20,(char *)"Postcondition", + (char *)"(\\old(X == 5 && Y == 2) ==> X == 7)",61); + if (! e_acsl_28) { e_acsl_35 = 1; } + else { + mpz_t e_acsl_29; + mpz_t e_acsl_31; + mpz_t e_acsl_32; + mpz_t e_acsl_33; + int e_acsl_34; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_29),(long)X); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_31),(long)e_acsl_30); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_32),(long)Y); + __gmpz_init((__mpz_struct *)(e_acsl_33)); + __gmpz_add((__mpz_struct *)(e_acsl_33), + (__mpz_struct const *)(e_acsl_31), + (__mpz_struct const *)(e_acsl_32)); + e_acsl_34 = __gmpz_cmp((__mpz_struct const *)(e_acsl_29), + (__mpz_struct const *)(e_acsl_33)); + e_acsl_35 = e_acsl_34 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_29)); + __gmpz_clear((__mpz_struct *)(e_acsl_31)); + __gmpz_clear((__mpz_struct *)(e_acsl_32)); + __gmpz_clear((__mpz_struct *)(e_acsl_33)); + } + e_acsl_assert(! e_acsl_35,(char *)"Postcondition", + (char *)"(\\old(X == 5 && Y == 2) ==> X == \\old(X)+Y)",62); + return; + } + +} + int main(void) { int __retres; @@ -390,6 +556,7 @@ int main(void) j(); k(); l(); + m(); __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_integer_constant.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_integer_constant.c index 2ca74e3aa20b1220c100b5497af0480d153238ba..c1c9b8bff3b4021ac9b9e3c6f2699120a1843ecb 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_integer_constant.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_integer_constant.c @@ -24,10 +24,13 @@ extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -36,10 +39,10 @@ int main(void) int __retres; int x; /*@ assert 0 ≡ 0; */ ; - if (! (0 == 0)) { e_acsl_fail((char *)"(0 == 0)"); } + e_acsl_assert(! (0 == 0),(char *)"Assertion",(char *)"(0 == 0)",8); x = 0; /*@ assert 0 ≢ 1; */ ; - if (! (0 != 1)) { e_acsl_fail((char *)"(0 != 1)"); } + e_acsl_assert(! (0 != 1),(char *)"Assertion",(char *)"(0 != 1)",9); /*@ assert 1152921504606846975 ≡ 0xfffffffffffffff; */ ; { mpz_t e_acsl_1; @@ -47,9 +50,8 @@ int main(void) __gmpz_init_set_str((__mpz_struct *)(e_acsl_1),"1152921504606846975",10); e_acsl_2 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_1)); - if (! (e_acsl_2 == 0)) { - e_acsl_fail((char *)"(1152921504606846975 == 0xfffffffffffffff)"); - } + e_acsl_assert(! (e_acsl_2 == 0),(char *)"Assertion", + (char *)"(1152921504606846975 == 0xfffffffffffffff)",10); __gmpz_clear((__mpz_struct *)(e_acsl_1)); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_invariant.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_invariant.c new file mode 100644 index 0000000000000000000000000000000000000000..4d155e54c5b058566c64bb7870f0abe5a0eb4911 --- /dev/null +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_invariant.c @@ -0,0 +1,87 @@ +/* Generated by Frama-C */ +struct __anonstruct___mpz_struct_1 { + int _mp_alloc ; + int _mp_size ; + unsigned long *_mp_d ; +}; +typedef struct __anonstruct___mpz_struct_1 __mpz_struct; +typedef __mpz_struct mpz_t[1]; +/*@ ensures \valid(\old(z)); + assigns *z; + assigns *z \from n; */ +extern void __gmpz_init_set_si(__mpz_struct * /*[1]*/ z, long n); +/*@ requires \valid(x); + assigns *x; */ +extern void __gmpz_clear(__mpz_struct * /*[1]*/ x); +/*@ requires \valid(z1); + requires \valid(z2); + assigns \nothing; */ +extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, + __mpz_struct const * /*[1]*/ z2); +/*@ terminates \false; + ensures \false; + assigns \nothing; */ +extern void exit(int status); +/*@ assigns \nothing; */ +extern int printf(char const * , ...); +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) +{ + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } + return; +} + +int main(void) +{ + int __retres; + int x; + x = 0; + { + int i; + i = 0; + while (1) { + if (! (i < 10)) { break; } + /*@ invariant 0 ≤ i ∧ i < 10; */ ; + { + mpz_t e_acsl_1; + mpz_t e_acsl_2; + int e_acsl_3; + int e_acsl_7; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_1),(long)0); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)i); + e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), + (__mpz_struct const *)(e_acsl_2)); + if (e_acsl_3 <= 0) { + mpz_t e_acsl_4; + mpz_t e_acsl_5; + int e_acsl_6; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_4),(long)i); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)10); + e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), + (__mpz_struct const *)(e_acsl_5)); + e_acsl_7 = e_acsl_6 < 0; + __gmpz_clear((__mpz_struct *)(e_acsl_4)); + __gmpz_clear((__mpz_struct *)(e_acsl_5)); + } + else { e_acsl_7 = 0; } + e_acsl_assert(! e_acsl_7,(char *)"Invariant", + (char *)"(0 <= i && i < 10)",8); + __gmpz_clear((__mpz_struct *)(e_acsl_1)); + __gmpz_clear((__mpz_struct *)(e_acsl_2)); + } + + x += i; + /*@ invariant i ≤ x; */ ; + e_acsl_assert(! (i <= x),(char *)"Invariant",(char *)"(i <= x)",10); + i ++; + } + } + + __retres = 0; + return (__retres); +} + + diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_lazy.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_lazy.c index 447aae04c8bfe3f8ab80db52866a4f36e1a27428..f35278396fd2db6a938adbe209be1125a1c4b24b 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_lazy.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_lazy.c @@ -24,10 +24,13 @@ extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -61,7 +64,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_5)); } else { e_acsl_7 = 0; } - if (! e_acsl_7) { e_acsl_fail((char *)"(x == 0 && y == 1)"); } + e_acsl_assert(! e_acsl_7,(char *)"Assertion", + (char *)"(x == 0 && y == 1)",10); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } @@ -83,7 +87,7 @@ int main(void) int e_acsl_14; __gmpz_init_set_si((__mpz_struct *)(e_acsl_11),(long)y); /*@ assert 0 ≢ 0; */ ; - if (0 == 0) { e_acsl_fail((char *)"(0 == 0)"); } + e_acsl_assert(0 == 0,(char *)"Assertion",(char *)"(0 == 0)",11); e_acsl_12 = 1 / 0; __gmpz_init_set_si((__mpz_struct *)(e_acsl_13),(long)e_acsl_12); e_acsl_14 = __gmpz_cmp((__mpz_struct const *)(e_acsl_11), @@ -93,7 +97,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_13)); } else { e_acsl_15 = 0; } - if (! (! e_acsl_15)) { e_acsl_fail((char *)"(!(x != 0 && y == 1/0))"); } + e_acsl_assert(! (! e_acsl_15),(char *)"Assertion", + (char *)"(!(x != 0 && y == 1/0))",11); __gmpz_clear((__mpz_struct *)(e_acsl_8)); __gmpz_clear((__mpz_struct *)(e_acsl_9)); } @@ -121,7 +126,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_19)); __gmpz_clear((__mpz_struct *)(e_acsl_20)); } - if (! e_acsl_22) { e_acsl_fail((char *)"(y == 1 || x == 1)"); } + e_acsl_assert(! e_acsl_22,(char *)"Assertion", + (char *)"(y == 1 || x == 1)",12); __gmpz_clear((__mpz_struct *)(e_acsl_16)); __gmpz_clear((__mpz_struct *)(e_acsl_17)); } @@ -144,7 +150,7 @@ int main(void) int e_acsl_29; __gmpz_init_set_si((__mpz_struct *)(e_acsl_26),(long)y); /*@ assert 0 ≢ 0; */ ; - if (0 == 0) { e_acsl_fail((char *)"(0 == 0)"); } + e_acsl_assert(0 == 0,(char *)"Assertion",(char *)"(0 == 0)",13); e_acsl_27 = 1 / 0; __gmpz_init_set_si((__mpz_struct *)(e_acsl_28),(long)e_acsl_27); e_acsl_29 = __gmpz_cmp((__mpz_struct const *)(e_acsl_26), @@ -153,7 +159,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_26)); __gmpz_clear((__mpz_struct *)(e_acsl_28)); } - if (! e_acsl_30) { e_acsl_fail((char *)"(x == 0 || y == 1/0)"); } + e_acsl_assert(! e_acsl_30,(char *)"Assertion", + (char *)"(x == 0 || y == 1/0)",13); __gmpz_clear((__mpz_struct *)(e_acsl_23)); __gmpz_clear((__mpz_struct *)(e_acsl_24)); } @@ -181,7 +188,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_34)); __gmpz_clear((__mpz_struct *)(e_acsl_35)); } - if (! e_acsl_37) { e_acsl_fail((char *)"(x == 0 ==> y == 1)"); } + e_acsl_assert(! e_acsl_37,(char *)"Assertion", + (char *)"(x == 0 ==> y == 1)",14); __gmpz_clear((__mpz_struct *)(e_acsl_31)); __gmpz_clear((__mpz_struct *)(e_acsl_32)); } @@ -204,7 +212,7 @@ int main(void) int e_acsl_44; __gmpz_init_set_si((__mpz_struct *)(e_acsl_41),(long)y); /*@ assert 0 ≢ 0; */ ; - if (0 == 0) { e_acsl_fail((char *)"(0 == 0)"); } + e_acsl_assert(0 == 0,(char *)"Assertion",(char *)"(0 == 0)",15); e_acsl_42 = 1 / 0; __gmpz_init_set_si((__mpz_struct *)(e_acsl_43),(long)e_acsl_42); e_acsl_44 = __gmpz_cmp((__mpz_struct const *)(e_acsl_41), @@ -213,11 +221,263 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_41)); __gmpz_clear((__mpz_struct *)(e_acsl_43)); } - if (! e_acsl_45) { e_acsl_fail((char *)"(x == 1 ==> y == 1/0)"); } + e_acsl_assert(! e_acsl_45,(char *)"Assertion", + (char *)"(x == 1 ==> y == 1/0)",15); __gmpz_clear((__mpz_struct *)(e_acsl_38)); __gmpz_clear((__mpz_struct *)(e_acsl_39)); } + /*@ assert x≢0? x ≢ 0: y ≢ 0; */ ; + { + mpz_t e_acsl_46; + mpz_t e_acsl_47; + int e_acsl_48; + int e_acsl_49; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_46),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_47),(long)0); + e_acsl_48 = __gmpz_cmp((__mpz_struct const *)(e_acsl_46), + (__mpz_struct const *)(e_acsl_47)); + if (e_acsl_48 != 0) { e_acsl_49 = x != 0; } + else { e_acsl_49 = y != 0; } + e_acsl_assert(! e_acsl_49,(char *)"Assertion", + (char *)"(x!=0? x != 0: y != 0)",16); + __gmpz_clear((__mpz_struct *)(e_acsl_46)); + __gmpz_clear((__mpz_struct *)(e_acsl_47)); + } + + /*@ assert y≢0? y ≢ 0: x ≢ 0; */ ; + { + mpz_t e_acsl_50; + mpz_t e_acsl_51; + int e_acsl_52; + int e_acsl_53; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_50),(long)y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_51),(long)0); + e_acsl_52 = __gmpz_cmp((__mpz_struct const *)(e_acsl_50), + (__mpz_struct const *)(e_acsl_51)); + if (e_acsl_52 != 0) { e_acsl_53 = y != 0; } + else { e_acsl_53 = x != 0; } + e_acsl_assert(! e_acsl_53,(char *)"Assertion", + (char *)"(y!=0? y != 0: x != 0)",17); + __gmpz_clear((__mpz_struct *)(e_acsl_50)); + __gmpz_clear((__mpz_struct *)(e_acsl_51)); + } + + /*@ assert x≡1? x ≡ 18: x ≡ 0; */ ; + { + mpz_t e_acsl_54; + mpz_t e_acsl_55; + int e_acsl_56; + int e_acsl_63; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_54),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_55),(long)1); + e_acsl_56 = __gmpz_cmp((__mpz_struct const *)(e_acsl_54), + (__mpz_struct const *)(e_acsl_55)); + if (e_acsl_56 == 0) { + mpz_t e_acsl_57; + mpz_t e_acsl_58; + int e_acsl_59; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_57),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_58),(long)18); + e_acsl_59 = __gmpz_cmp((__mpz_struct const *)(e_acsl_57), + (__mpz_struct const *)(e_acsl_58)); + e_acsl_63 = e_acsl_59 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_57)); + __gmpz_clear((__mpz_struct *)(e_acsl_58)); + } + else { + mpz_t e_acsl_60; + mpz_t e_acsl_61; + int e_acsl_62; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_60),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_61),(long)0); + e_acsl_62 = __gmpz_cmp((__mpz_struct const *)(e_acsl_60), + (__mpz_struct const *)(e_acsl_61)); + e_acsl_63 = e_acsl_62 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_60)); + __gmpz_clear((__mpz_struct *)(e_acsl_61)); + } + e_acsl_assert(! e_acsl_63,(char *)"Assertion", + (char *)"(x==1? x == 18: x == 0)",18); + __gmpz_clear((__mpz_struct *)(e_acsl_54)); + __gmpz_clear((__mpz_struct *)(e_acsl_55)); + } + + /*@ assert x ≡ 2 ⇔ y ≡ 3; */ ; + { + mpz_t e_acsl_64; + mpz_t e_acsl_65; + int e_acsl_66; + int e_acsl_70; + int e_acsl_78; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_64),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_65),(long)2); + e_acsl_66 = __gmpz_cmp((__mpz_struct const *)(e_acsl_64), + (__mpz_struct const *)(e_acsl_65)); + if (! (e_acsl_66 == 0)) { e_acsl_70 = 1; } + else { + mpz_t e_acsl_67; + mpz_t e_acsl_68; + int e_acsl_69; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_67),(long)y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_68),(long)3); + e_acsl_69 = __gmpz_cmp((__mpz_struct const *)(e_acsl_67), + (__mpz_struct const *)(e_acsl_68)); + e_acsl_70 = e_acsl_69 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_67)); + __gmpz_clear((__mpz_struct *)(e_acsl_68)); + } + if (e_acsl_70) { + mpz_t e_acsl_71; + mpz_t e_acsl_72; + int e_acsl_73; + int e_acsl_77; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_71),(long)y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_72),(long)3); + e_acsl_73 = __gmpz_cmp((__mpz_struct const *)(e_acsl_71), + (__mpz_struct const *)(e_acsl_72)); + if (! (e_acsl_73 == 0)) { e_acsl_77 = 1; } + else { + mpz_t e_acsl_74; + mpz_t e_acsl_75; + int e_acsl_76; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_74),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_75),(long)2); + e_acsl_76 = __gmpz_cmp((__mpz_struct const *)(e_acsl_74), + (__mpz_struct const *)(e_acsl_75)); + e_acsl_77 = e_acsl_76 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_74)); + __gmpz_clear((__mpz_struct *)(e_acsl_75)); + } + e_acsl_78 = e_acsl_77; + __gmpz_clear((__mpz_struct *)(e_acsl_71)); + __gmpz_clear((__mpz_struct *)(e_acsl_72)); + } + else { e_acsl_78 = 0; } + e_acsl_assert(! e_acsl_78,(char *)"Assertion", + (char *)"(x == 2 <==> y == 3)",21); + __gmpz_clear((__mpz_struct *)(e_acsl_64)); + __gmpz_clear((__mpz_struct *)(e_acsl_65)); + } + + /*@ assert x ≡ 0 ⇔ y ≡ 1; */ ; + { + mpz_t e_acsl_79; + mpz_t e_acsl_80; + int e_acsl_81; + int e_acsl_85; + int e_acsl_93; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_79),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_80),(long)0); + e_acsl_81 = __gmpz_cmp((__mpz_struct const *)(e_acsl_79), + (__mpz_struct const *)(e_acsl_80)); + if (! (e_acsl_81 == 0)) { e_acsl_85 = 1; } + else { + mpz_t e_acsl_82; + mpz_t e_acsl_83; + int e_acsl_84; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_82),(long)y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_83),(long)1); + e_acsl_84 = __gmpz_cmp((__mpz_struct const *)(e_acsl_82), + (__mpz_struct const *)(e_acsl_83)); + e_acsl_85 = e_acsl_84 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_82)); + __gmpz_clear((__mpz_struct *)(e_acsl_83)); + } + if (e_acsl_85) { + mpz_t e_acsl_86; + mpz_t e_acsl_87; + int e_acsl_88; + int e_acsl_92; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_86),(long)y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_87),(long)1); + e_acsl_88 = __gmpz_cmp((__mpz_struct const *)(e_acsl_86), + (__mpz_struct const *)(e_acsl_87)); + if (! (e_acsl_88 == 0)) { e_acsl_92 = 1; } + else { + mpz_t e_acsl_89; + mpz_t e_acsl_90; + int e_acsl_91; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_89),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_90),(long)0); + e_acsl_91 = __gmpz_cmp((__mpz_struct const *)(e_acsl_89), + (__mpz_struct const *)(e_acsl_90)); + e_acsl_92 = e_acsl_91 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_89)); + __gmpz_clear((__mpz_struct *)(e_acsl_90)); + } + e_acsl_93 = e_acsl_92; + __gmpz_clear((__mpz_struct *)(e_acsl_86)); + __gmpz_clear((__mpz_struct *)(e_acsl_87)); + } + else { e_acsl_93 = 0; } + e_acsl_assert(! e_acsl_93,(char *)"Assertion", + (char *)"(x == 0 <==> y == 1)",22); + __gmpz_clear((__mpz_struct *)(e_acsl_79)); + __gmpz_clear((__mpz_struct *)(e_acsl_80)); + } + + /*@ assert ((x≢0? x: y)≢0) ≡ (x≡0); */ ; + { + mpz_t e_acsl_94; + mpz_t e_acsl_95; + int e_acsl_96; + int e_acsl_97; + mpz_t e_acsl_98; + int e_acsl_99; + int e_acsl_100; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_94),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_95),(long)0); + e_acsl_96 = __gmpz_cmp((__mpz_struct const *)(e_acsl_94), + (__mpz_struct const *)(e_acsl_95)); + if (e_acsl_96 != 0) { e_acsl_97 = x; } + else { e_acsl_97 = y; } + __gmpz_init_set_si((__mpz_struct *)(e_acsl_98),(long)e_acsl_97); + e_acsl_99 = __gmpz_cmp((__mpz_struct const *)(e_acsl_98), + (__mpz_struct const *)(e_acsl_95)); + e_acsl_100 = __gmpz_cmp((__mpz_struct const *)(e_acsl_94), + (__mpz_struct const *)(e_acsl_95)); + e_acsl_assert(! ((e_acsl_99 != 0) == (e_acsl_100 == 0)), + (char *)"Assertion", + (char *)"(((x!=0? x: y)!=0) == (x==0))",25); + __gmpz_clear((__mpz_struct *)(e_acsl_94)); + __gmpz_clear((__mpz_struct *)(e_acsl_95)); + __gmpz_clear((__mpz_struct *)(e_acsl_98)); + } + + /*@ assert (x ≢ 0 ∧ y ≢ 0) ∨ y ≢ 0; */ ; + { int e_acsl_101; + int e_acsl_102; + if (x != 0) { e_acsl_101 = y != 0; } + else { e_acsl_101 = 0; } + if (e_acsl_101) { e_acsl_102 = 1; } + else { e_acsl_102 = y != 0; } + e_acsl_assert(! e_acsl_102,(char *)"Assertion", + (char *)"((x != 0 && y != 0) || y != 0)",26); + } + + /*@ assert (x ≢ 0 ∨ y ≢ 0) ∧ y ≡ 1; */ ; + { int e_acsl_103; + int e_acsl_107; + if (x != 0) { e_acsl_103 = 1; } + else { e_acsl_103 = y != 0; } + if (e_acsl_103) { + mpz_t e_acsl_104; + mpz_t e_acsl_105; + int e_acsl_106; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_104),(long)y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_105),(long)1); + e_acsl_106 = __gmpz_cmp((__mpz_struct const *)(e_acsl_104), + (__mpz_struct const *)(e_acsl_105)); + e_acsl_107 = e_acsl_106 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_104)); + __gmpz_clear((__mpz_struct *)(e_acsl_105)); + } + else { e_acsl_107 = 0; } + e_acsl_assert(! e_acsl_107,(char *)"Assertion", + (char *)"((x != 0 || y != 0) && y == 1)",27); + } + __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_nested_code_annot.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_nested_code_annot.c index b105ed79e39cc555b674f1088901283bb6c2f180..c3b27fd488375c1e7f4ad6bfe67cec52e7d52f62 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_nested_code_annot.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_nested_code_annot.c @@ -24,10 +24,13 @@ extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -39,7 +42,7 @@ int main(void) x = 0; y = 1; /*@ assert x < y; */ ; - if (! (x < y)) { e_acsl_fail((char *)"(x < y)"); } + e_acsl_assert(! (x < y),(char *)"Assertion",(char *)"(x < y)",8); /*@ requires x ≡ 0; ensures x ≥ 1; */ { @@ -54,12 +57,14 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)0); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(x == 0)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Precondition", + (char *)"(x == 0)",9); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); if (x) { /*@ assert \false; */ ; - e_acsl_fail((char *)"(\\false)"); } + e_acsl_assert(1,(char *)"Assertion",(char *)"(\\false)",12); + } else { /*@ requires x ≡ 0; ensures x ≡ 1; */ @@ -75,7 +80,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)0); e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_6 == 0)) { e_acsl_fail((char *)"(x == 0)"); } + e_acsl_assert(! (e_acsl_6 == 0),(char *)"Precondition", + (char *)"(x == 0)",14); __gmpz_clear((__mpz_struct *)(e_acsl_4)); __gmpz_clear((__mpz_struct *)(e_acsl_5)); x ++; @@ -85,7 +91,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_8),(long)1); e_acsl_9 = __gmpz_cmp((__mpz_struct const *)(e_acsl_7), (__mpz_struct const *)(e_acsl_8)); - if (! (e_acsl_9 == 0)) { e_acsl_fail((char *)"(x == 1)"); } + e_acsl_assert(! (e_acsl_9 == 0),(char *)"Postcondition", + (char *)"(x == 1)",15); __gmpz_clear((__mpz_struct *)(e_acsl_7)); __gmpz_clear((__mpz_struct *)(e_acsl_8)); } @@ -105,7 +112,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_11),(long)1); e_acsl_12 = __gmpz_cmp((__mpz_struct const *)(e_acsl_10), (__mpz_struct const *)(e_acsl_11)); - if (! (e_acsl_12 == 0)) { e_acsl_fail((char *)"(x == 1)"); } + e_acsl_assert(! (e_acsl_12 == 0),(char *)"Precondition", + (char *)"(x == 1)",18); __gmpz_clear((__mpz_struct *)(e_acsl_10)); __gmpz_clear((__mpz_struct *)(e_acsl_11)); x ++; @@ -115,7 +123,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_14),(long)2); e_acsl_15 = __gmpz_cmp((__mpz_struct const *)(e_acsl_13), (__mpz_struct const *)(e_acsl_14)); - if (! (e_acsl_15 == 0)) { e_acsl_fail((char *)"(x == 2)"); } + e_acsl_assert(! (e_acsl_15 == 0),(char *)"Postcondition", + (char *)"(x == 2)",19); __gmpz_clear((__mpz_struct *)(e_acsl_13)); __gmpz_clear((__mpz_struct *)(e_acsl_14)); } @@ -123,7 +132,8 @@ int main(void) } else { /*@ assert \false; */ ; - e_acsl_fail((char *)"(\\false)"); } + e_acsl_assert(1,(char *)"Assertion",(char *)"(\\false)",22); + } } } @@ -131,7 +141,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_17),(long)1); e_acsl_18 = __gmpz_cmp((__mpz_struct const *)(e_acsl_16), (__mpz_struct const *)(e_acsl_17)); - if (! (e_acsl_18 >= 0)) { e_acsl_fail((char *)"(x >= 1)"); } + e_acsl_assert(! (e_acsl_18 >= 0),(char *)"Postcondition", + (char *)"(x >= 1)",10); __gmpz_clear((__mpz_struct *)(e_acsl_16)); __gmpz_clear((__mpz_struct *)(e_acsl_17)); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_not.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_not.c index 73be4f6b637bcca7ebd23c677a48d55a3e7661b9..983aa7bc1abbe292b7dc015b432fc956e915bfd9 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_not.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_not.c @@ -5,10 +5,13 @@ extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -18,10 +21,10 @@ int main(void) int x; x = 0; /*@ assert x ≡ 0; */ ; - if (! (x == 0)) { e_acsl_fail((char *)"(x == 0)"); } + e_acsl_assert(! (x == 0),(char *)"Assertion",(char *)"(x == 0)",7); if (x) { /*@ assert x ≢ 0; */ ; - if (! (x != 0)) { e_acsl_fail((char *)"(x != 0)"); } + e_acsl_assert(! (x != 0),(char *)"Assertion",(char *)"(x != 0)",8); } __retres = 0; return (__retres); diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_null.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_null.c index 80018634e1f0475f4ceef2e9d0beaf156a73b2ca..7e91e650a5fea09d6ffff30ac8876ff1fa17e540 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_null.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_null.c @@ -5,10 +5,13 @@ extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -16,9 +19,8 @@ int main(void) { int __retres; /*@ assert \null ≡ (void *)0; */ ; - if (! ((void *)0 == (void *)0)) { - e_acsl_fail((char *)"(\\null == (void *)0)"); - } + e_acsl_assert(! ((void *)0 == (void *)0),(char *)"Assertion", + (char *)"(\\null == (void *)0)",7); __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_other_constants.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_other_constants.c index 725e95c783c57f4c81fa0c9ac51c209895c64946..8b09c20c339950c209342a3fb4a74b8ec607a16d 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_other_constants.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_other_constants.c @@ -28,10 +28,13 @@ extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -39,8 +42,8 @@ int main(void) { int __retres; /*@ assert "toto" ≢ "titi"; */ ; - if (! ("toto" != "titi")) { e_acsl_fail((char *)"(\"toto\" != \"titi\")"); - } + e_acsl_assert(! ("toto" != "titi"),(char *)"Assertion", + (char *)"(\"toto\" != \"titi\")",9); /*@ assert 'c' ≡ 'c'; */ ; { mpz_t e_acsl_1; @@ -48,12 +51,14 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_1),(long)'c'); e_acsl_2 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_1)); - if (! (e_acsl_2 == 0)) { e_acsl_fail((char *)"(\'c\' == \'c\')"); } + e_acsl_assert(! (e_acsl_2 == 0),(char *)"Assertion", + (char *)"(\'c\' == \'c\')",10); __gmpz_clear((__mpz_struct *)(e_acsl_1)); } /*@ assert false ≢ true; */ ; - if (! (false != true)) { e_acsl_fail((char *)"(false != true)"); } + e_acsl_assert(! (false != true),(char *)"Assertion", + (char *)"(false != true)",11); __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_ptr.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_ptr.c index 6174f6a082247822ee3ee51664a4c5e7db925bf0..a8a971d535fd26200e24402236a651ac4e4f07e9 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_ptr.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_ptr.c @@ -62,10 +62,13 @@ extern long __gmpz_get_si(__mpz_struct const * /*[1]*/ z); extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -89,7 +92,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)1); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(*p == 1)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Assertion",(char *)"(*p == 1)", + 12); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } @@ -103,7 +107,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)2); e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_6 == 0)) { e_acsl_fail((char *)"(t[0] == 2)"); } + e_acsl_assert(! (e_acsl_6 == 0),(char *)"Assertion", + (char *)"(t[0] == 2)",13); __gmpz_clear((__mpz_struct *)(e_acsl_4)); __gmpz_clear((__mpz_struct *)(e_acsl_5)); } @@ -117,7 +122,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_8),(long)4); e_acsl_9 = __gmpz_cmp((__mpz_struct const *)(e_acsl_7), (__mpz_struct const *)(e_acsl_8)); - if (! (e_acsl_9 == 0)) { e_acsl_fail((char *)"(t[2] == 4)"); } + e_acsl_assert(! (e_acsl_9 == 0),(char *)"Assertion", + (char *)"(t[2] == 4)",14); __gmpz_clear((__mpz_struct *)(e_acsl_7)); __gmpz_clear((__mpz_struct *)(e_acsl_8)); } @@ -146,7 +152,8 @@ int main(void) (__mpz_struct const *)(e_acsl_14)); __gmpz_init((__mpz_struct *)(e_acsl_16)); /*@ assert sizeof((int)0x0) ≢ 0; */ ; - if (e_acsl_15 == 0) { e_acsl_fail((char *)"(sizeof((int)0x0) == 0)"); } + e_acsl_assert(e_acsl_15 == 0,(char *)"Assertion", + (char *)"(sizeof((int)0x0) == 0)",15); __gmpz_tdiv_q((__mpz_struct *)(e_acsl_16), (__mpz_struct const *)(e_acsl_12), (__mpz_struct const *)(e_acsl_13)); @@ -155,9 +162,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_19),(long)4); e_acsl_20 = __gmpz_cmp((__mpz_struct const *)(e_acsl_18), (__mpz_struct const *)(e_acsl_19)); - if (! (e_acsl_20 == 0)) { - e_acsl_fail((char *)"(t[(2*sizeof(int))/sizeof((int)0x0)] == 4)"); - } + e_acsl_assert(! (e_acsl_20 == 0),(char *)"Assertion", + (char *)"(t[(2*sizeof(int))/sizeof((int)0x0)] == 4)",15); __gmpz_clear((__mpz_struct *)(e_acsl_10)); __gmpz_clear((__mpz_struct *)(e_acsl_11)); __gmpz_clear((__mpz_struct *)(e_acsl_12)); @@ -189,7 +195,8 @@ int main(void) (__mpz_struct const *)(e_acsl_23)); e_acsl_25 = __gmpz_cmp((__mpz_struct const *)(e_acsl_21), (__mpz_struct const *)(e_acsl_24)); - if (! (e_acsl_25 == 0)) { e_acsl_fail((char *)"(t[i] == i+2)"); } + e_acsl_assert(! (e_acsl_25 == 0),(char *)"Assertion", + (char *)"(t[i] == i+2)",18); __gmpz_clear((__mpz_struct *)(e_acsl_21)); __gmpz_clear((__mpz_struct *)(e_acsl_22)); __gmpz_clear((__mpz_struct *)(e_acsl_23)); @@ -221,7 +228,8 @@ int main(void) (__mpz_struct const *)(e_acsl_27)); e_acsl_33 = __gmpz_cmp((__mpz_struct const *)(e_acsl_30), (__mpz_struct const *)(e_acsl_32)); - if (! (e_acsl_33 == 0)) { e_acsl_fail((char *)"(t[2-i] == 4-i)"); } + e_acsl_assert(! (e_acsl_33 == 0),(char *)"Assertion", + (char *)"(t[2-i] == 4-i)",19); __gmpz_clear((__mpz_struct *)(e_acsl_26)); __gmpz_clear((__mpz_struct *)(e_acsl_27)); __gmpz_clear((__mpz_struct *)(e_acsl_28)); @@ -246,8 +254,8 @@ int main(void) (__mpz_struct const *)(e_acsl_36)); e_acsl_38 = __gmpz_cmp((__mpz_struct const *)(e_acsl_34), (__mpz_struct const *)(e_acsl_37)); - if (! (e_acsl_38 == 0)) { e_acsl_fail((char *)"(*(&t[2]-i) == 4-i)"); - } + e_acsl_assert(! (e_acsl_38 == 0),(char *)"Assertion", + (char *)"(*(&t[2]-i) == 4-i)",20); __gmpz_clear((__mpz_struct *)(e_acsl_34)); __gmpz_clear((__mpz_struct *)(e_acsl_35)); __gmpz_clear((__mpz_struct *)(e_acsl_36)); @@ -269,7 +277,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_40),(long)5); e_acsl_41 = __gmpz_cmp((__mpz_struct const *)(e_acsl_39), (__mpz_struct const *)(e_acsl_40)); - if (! (e_acsl_41 == 0)) { e_acsl_fail((char *)"(*p == 5)"); } + e_acsl_assert(! (e_acsl_41 == 0),(char *)"Assertion",(char *)"(*p == 5)", + 26); __gmpz_clear((__mpz_struct *)(e_acsl_39)); __gmpz_clear((__mpz_struct *)(e_acsl_40)); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_quantif.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_quantif.c index e0eccda5044fae0035a39903dc5eed6c151d6099..82da5c054a423a6cb8964259fdf109e2fb932f6d 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_quantif.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_quantif.c @@ -34,24 +34,52 @@ extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, extern void __gmpz_add(__mpz_struct * /*[1]*/ z1, __mpz_struct const * /*[1]*/ z2, __mpz_struct const * /*[1]*/ z3); +/*@ requires \valid(z1); + requires \valid(z2); + requires \valid(z3); + assigns *z1; +*/ +extern void __gmpz_mul(__mpz_struct * /*[1]*/ z1, + __mpz_struct const * /*[1]*/ z2, + __mpz_struct const * /*[1]*/ z3); +/*@ requires \valid(z1); + requires \valid(z2); + requires \valid(z3); + assigns *z1; +*/ +extern void __gmpz_tdiv_q(__mpz_struct * /*[1]*/ z1, + __mpz_struct const * /*[1]*/ z2, + __mpz_struct const * /*[1]*/ z3); +/*@ requires \valid(z1); + requires \valid(z2); + requires \valid(z3); + assigns *z1; +*/ +extern void __gmpz_tdiv_r(__mpz_struct * /*[1]*/ z1, + __mpz_struct const * /*[1]*/ z2, + __mpz_struct const * /*[1]*/ z3); +/*@ requires \valid(z); + assigns \nothing; */ +extern long __gmpz_get_si(__mpz_struct const * /*[1]*/ z); /*@ terminates \false; ensures \false; assigns \nothing; */ extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } int main(void) { int __retres; - int a; - a = -1; /*@ assert ∀ ℤ x; 0 ≤ x ∧ x ≤ 1 ⇒ x ≡ 0 ∨ x ≡ 1; */ ; { mpz_t e_acsl_1; @@ -115,9 +143,9 @@ int main(void) } e_acsl_end_loop1: ; - if (! e_acsl_2) { - e_acsl_fail((char *)"(\\forall integer x; 0 <= x && x <= 1 ==> x == 0 || x == 1)"); - } + e_acsl_assert(! e_acsl_2,(char *)"Assertion", + (char *)"(\\forall integer x; 0 <= x && x <= 1 ==> x == 0 || x == 1)", + 10); __gmpz_clear((__mpz_struct *)(e_acsl_1)); } @@ -183,9 +211,9 @@ int main(void) } e_acsl_end_loop2: ; - if (! e_acsl_14) { - e_acsl_fail((char *)"(\\forall integer x; 0 < x && x <= 1 ==> x == 1)"); - } + e_acsl_assert(! e_acsl_14,(char *)"Assertion", + (char *)"(\\forall integer x; 0 < x && x <= 1 ==> x == 1)", + 11); __gmpz_clear((__mpz_struct *)(e_acsl_13)); } @@ -241,9 +269,9 @@ int main(void) } e_acsl_end_loop3: ; - if (! e_acsl_25) { - e_acsl_fail((char *)"(\\forall integer x; 0 < x && x < 1 ==> \\false)"); - } + e_acsl_assert(! e_acsl_25,(char *)"Assertion", + (char *)"(\\forall integer x; 0 < x && x < 1 ==> \\false)", + 12); __gmpz_clear((__mpz_struct *)(e_acsl_24)); } @@ -300,9 +328,9 @@ int main(void) } e_acsl_end_loop4: ; - if (! e_acsl_34) { - e_acsl_fail((char *)"(\\forall integer x; 0 <= x && x < 1 ==> x == 0)"); - } + e_acsl_assert(! e_acsl_34,(char *)"Assertion", + (char *)"(\\forall integer x; 0 <= x && x < 1 ==> x == 0)", + 13); __gmpz_clear((__mpz_struct *)(e_acsl_33)); } @@ -316,9 +344,9 @@ int main(void) mpz_t e_acsl_44; int e_acsl_45; e_acsl_45 = 1; - __gmpz_init((__mpz_struct *)(e_acsl_44)); - __gmpz_init((__mpz_struct *)(e_acsl_43)); __gmpz_init((__mpz_struct *)(e_acsl_42)); + __gmpz_init((__mpz_struct *)(e_acsl_43)); + __gmpz_init((__mpz_struct *)(e_acsl_44)); { mpz_t e_acsl_59; __gmpz_init_set_si((__mpz_struct *)(e_acsl_59),(long)0); @@ -443,14 +471,221 @@ int main(void) } e_acsl_end_loop5: ; - if (! e_acsl_45) { - e_acsl_fail((char *)"(\\forall integer x, integer y, integer z;\n ((0 <= x && x < 2) && (0 <= y && y < 5)) && (0 <= z && z <= y) ==>\n x+z <= y+1)"); - } + e_acsl_assert(! e_acsl_45,(char *)"Assertion", + (char *)"(\\forall integer x, integer y, integer z;\n ((0 <= x && x < 2) && (0 <= y && y < 5)) && (0 <= z && z <= y) ==>\n x+z <= y+1)", + 17); __gmpz_clear((__mpz_struct *)(e_acsl_42)); __gmpz_clear((__mpz_struct *)(e_acsl_43)); __gmpz_clear((__mpz_struct *)(e_acsl_44)); } + /*@ assert ∃ int x; (0 ≤ x ∧ x < 10) ∧ x ≡ 5; */ ; + { + mpz_t e_acsl_64; + int e_acsl_65; + e_acsl_65 = 0; + __gmpz_init((__mpz_struct *)(e_acsl_64)); + { + mpz_t e_acsl_68; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_68),(long)0); + __gmpz_set((__mpz_struct *)(e_acsl_64), + (__mpz_struct const *)(e_acsl_68)); + __gmpz_clear((__mpz_struct *)(e_acsl_68)); + } + + while (1) { + { + mpz_t e_acsl_69; + int e_acsl_70; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_69),(long)10); + e_acsl_70 = __gmpz_cmp((__mpz_struct const *)(e_acsl_64), + (__mpz_struct const *)(e_acsl_69)); + if (! (e_acsl_70 < 0)) { break; } + __gmpz_clear((__mpz_struct *)(e_acsl_69)); + } + + { + mpz_t e_acsl_66; + int e_acsl_67; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_66),(long)5); + e_acsl_67 = __gmpz_cmp((__mpz_struct const *)(e_acsl_64), + (__mpz_struct const *)(e_acsl_66)); + __gmpz_clear((__mpz_struct *)(e_acsl_66)); + if (! (! (e_acsl_67 == 0))) { + e_acsl_65 = 1; + goto e_acsl_end_loop6; } + } + + { + mpz_t e_acsl_71; + mpz_t e_acsl_72; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_71),(long)((char)1)); + __gmpz_init((__mpz_struct *)(e_acsl_72)); + __gmpz_add((__mpz_struct *)(e_acsl_72), + (__mpz_struct const *)(e_acsl_64), + (__mpz_struct const *)(e_acsl_71)); + __gmpz_set((__mpz_struct *)(e_acsl_64), + (__mpz_struct const *)(e_acsl_72)); + __gmpz_clear((__mpz_struct *)(e_acsl_71)); + __gmpz_clear((__mpz_struct *)(e_acsl_72)); + } + + } + e_acsl_end_loop6: ; + e_acsl_assert(! e_acsl_65,(char *)"Assertion", + (char *)"(\\exists int x; (0 <= x && x < 10) && x == 5)", + 22); + } + + /*@ + assert ∀ int x; 0 ≤ x ∧ x < 10 ⇒ + (x%2 ≡ 0 ⇒ (∃ ℤ y; (0 ≤ y ∧ y ≤ x/2) ∧ x ≡ 2*y)); */ ; + { + mpz_t e_acsl_73; + int e_acsl_74; + e_acsl_74 = 1; + __gmpz_init((__mpz_struct *)(e_acsl_73)); + { + mpz_t e_acsl_93; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_93),(long)0); + __gmpz_set((__mpz_struct *)(e_acsl_73), + (__mpz_struct const *)(e_acsl_93)); + __gmpz_clear((__mpz_struct *)(e_acsl_93)); + } + + while (1) { + { + mpz_t e_acsl_94; + int e_acsl_95; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_94),(long)10); + e_acsl_95 = __gmpz_cmp((__mpz_struct const *)(e_acsl_73), + (__mpz_struct const *)(e_acsl_94)); + if (! (e_acsl_95 < 0)) { break; } + __gmpz_clear((__mpz_struct *)(e_acsl_94)); + } + + { + mpz_t e_acsl_75; + int e_acsl_76; + mpz_t e_acsl_77; + mpz_t e_acsl_78; + int e_acsl_79; + int e_acsl_92; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_75),(long)2); + e_acsl_76 = (int)__gmpz_get_si((__mpz_struct const *)(e_acsl_75)); + __gmpz_init((__mpz_struct *)(e_acsl_77)); + /*@ assert 2 ≢ 0; */ ; + e_acsl_assert(e_acsl_76 == 0,(char *)"Assertion",(char *)"(2 == 0)", + 27); + __gmpz_tdiv_r((__mpz_struct *)(e_acsl_77), + (__mpz_struct const *)(e_acsl_73), + (__mpz_struct const *)(e_acsl_75)); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_78),(long)0); + e_acsl_79 = __gmpz_cmp((__mpz_struct const *)(e_acsl_77), + (__mpz_struct const *)(e_acsl_78)); + if (! (e_acsl_79 == 0)) { e_acsl_92 = 1; } + else { + mpz_t e_acsl_80; + int e_acsl_81; + e_acsl_81 = 0; + __gmpz_init((__mpz_struct *)(e_acsl_80)); + { + mpz_t e_acsl_85; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_85),(long)0); + __gmpz_set((__mpz_struct *)(e_acsl_80), + (__mpz_struct const *)(e_acsl_85)); + __gmpz_clear((__mpz_struct *)(e_acsl_85)); + } + + while (1) { + { + mpz_t e_acsl_86; + int e_acsl_87; + mpz_t e_acsl_88; + int e_acsl_89; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_86),(long)2); + e_acsl_87 = (int)__gmpz_get_si((__mpz_struct const *)(e_acsl_86)); + __gmpz_init((__mpz_struct *)(e_acsl_88)); + /*@ assert 2 ≢ 0; */ ; + e_acsl_assert(e_acsl_87 == 0,(char *)"Assertion", + (char *)"(2 == 0)",27); + __gmpz_tdiv_q((__mpz_struct *)(e_acsl_88), + (__mpz_struct const *)(e_acsl_73), + (__mpz_struct const *)(e_acsl_86)); + e_acsl_89 = __gmpz_cmp((__mpz_struct const *)(e_acsl_80), + (__mpz_struct const *)(e_acsl_88)); + if (! (e_acsl_89 <= 0)) { break; } + __gmpz_clear((__mpz_struct *)(e_acsl_86)); + __gmpz_clear((__mpz_struct *)(e_acsl_88)); + } + + { + mpz_t e_acsl_82; + mpz_t e_acsl_83; + int e_acsl_84; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_82),(long)2); + __gmpz_init((__mpz_struct *)(e_acsl_83)); + __gmpz_mul((__mpz_struct *)(e_acsl_83), + (__mpz_struct const *)(e_acsl_82), + (__mpz_struct const *)(e_acsl_80)); + e_acsl_84 = __gmpz_cmp((__mpz_struct const *)(e_acsl_73), + (__mpz_struct const *)(e_acsl_83)); + __gmpz_clear((__mpz_struct *)(e_acsl_82)); + __gmpz_clear((__mpz_struct *)(e_acsl_83)); + if (! (! (e_acsl_84 == 0))) { + e_acsl_81 = 1; + goto e_acsl_end_loop7; + } + } + + { + mpz_t e_acsl_90; + mpz_t e_acsl_91; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_90),(long)((char)1)); + __gmpz_init((__mpz_struct *)(e_acsl_91)); + __gmpz_add((__mpz_struct *)(e_acsl_91), + (__mpz_struct const *)(e_acsl_80), + (__mpz_struct const *)(e_acsl_90)); + __gmpz_set((__mpz_struct *)(e_acsl_80), + (__mpz_struct const *)(e_acsl_91)); + __gmpz_clear((__mpz_struct *)(e_acsl_90)); + __gmpz_clear((__mpz_struct *)(e_acsl_91)); + } + + } + e_acsl_end_loop7: ; + e_acsl_92 = e_acsl_81; + __gmpz_clear((__mpz_struct *)(e_acsl_80)); + } + __gmpz_clear((__mpz_struct *)(e_acsl_75)); + __gmpz_clear((__mpz_struct *)(e_acsl_77)); + __gmpz_clear((__mpz_struct *)(e_acsl_78)); + if (! e_acsl_92) { + e_acsl_74 = 0; + goto e_acsl_end_loop8; } + } + + { + mpz_t e_acsl_96; + mpz_t e_acsl_97; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_96),(long)((char)1)); + __gmpz_init((__mpz_struct *)(e_acsl_97)); + __gmpz_add((__mpz_struct *)(e_acsl_97), + (__mpz_struct const *)(e_acsl_73), + (__mpz_struct const *)(e_acsl_96)); + __gmpz_set((__mpz_struct *)(e_acsl_73), + (__mpz_struct const *)(e_acsl_97)); + __gmpz_clear((__mpz_struct *)(e_acsl_96)); + __gmpz_clear((__mpz_struct *)(e_acsl_97)); + } + + } + e_acsl_end_loop8: ; + e_acsl_assert(! e_acsl_74,(char *)"Assertion", + (char *)"(\\forall int x; 0 <= x && x < 10 ==>\n (x%2 == 0 ==> (\\exists integer y; (0 <= y && y <= x/2) && x == 2*y)))", + 26); + } + __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_result.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_result.c index 7b7b4df213411e33f12ef704692ac4ff6fcdea17..e619c835a3f648c27805c2eb05e3c6e5694a9664 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_result.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_result.c @@ -38,10 +38,13 @@ extern long __gmpz_get_si(__mpz_struct const * /*[1]*/ z); extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -62,9 +65,8 @@ int f(int x) __gmpz_sub((__mpz_struct *)(e_acsl_4),(__mpz_struct const *)(e_acsl_2), (__mpz_struct const *)(e_acsl_2)); e_acsl_5 = (int)__gmpz_get_si((__mpz_struct const *)(e_acsl_4)); - if (! (x == e_acsl_5)) { - e_acsl_fail((char *)"(\\result == (int)(\\old(x)-\\old(x)))"); - } + e_acsl_assert(! (x == e_acsl_5),(char *)"Postcondition", + (char *)"(\\result == (int)(\\old(x)-\\old(x)))",6); __gmpz_clear((__mpz_struct *)(e_acsl_2)); __gmpz_clear((__mpz_struct *)(e_acsl_4)); return (x); @@ -76,7 +78,8 @@ int Y = 1; /*@ ensures \result ≡ Y; */ int g(int x) { - if (! (x == Y)) { e_acsl_fail((char *)"(\\result == Y)"); } + e_acsl_assert(! (x == Y),(char *)"Postcondition",(char *)"(\\result == Y)", + 17); return (x); } @@ -93,7 +96,8 @@ int h(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)0); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(\\result == 0)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Postcondition", + (char *)"(\\result == 0)",22); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); return (__retres); diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_sizeof.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_sizeof.c index 0357a9b29850279fdd0973f2dff5be8674d529cf..d7d4076537a52328d104281b3760754880e4200f 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_sizeof.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_sizeof.c @@ -24,10 +24,13 @@ extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -45,9 +48,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)4); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { - e_acsl_fail((char *)"(sizeof(int) == sizeof(x))"); - } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Assertion", + (char *)"(sizeof(int) == sizeof(x))",8); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } @@ -61,9 +63,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)4); e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_6 == 0)) { - e_acsl_fail((char *)"(sizeof(\"totototototo\") == sizeof(char *))"); - } + e_acsl_assert(! (e_acsl_6 == 0),(char *)"Assertion", + (char *)"(sizeof(\"totototototo\") == sizeof(char *))",9); __gmpz_clear((__mpz_struct *)(e_acsl_4)); __gmpz_clear((__mpz_struct *)(e_acsl_5)); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_stmt_contract.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_stmt_contract.c index b8c8db76241e845ec1addb2b6cbe83425805b820..4e33af4f98a44f3b43aceef6e1ca33e146738ed3 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_stmt_contract.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_stmt_contract.c @@ -35,10 +35,13 @@ extern void __gmpz_add(__mpz_struct * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -59,7 +62,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)1); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(x == 1)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Postcondition", + (char *)"(x == 1)",8); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } @@ -77,11 +81,13 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)2); e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_6 == 0)) { e_acsl_fail((char *)"(x == 2)"); } + e_acsl_assert(! (e_acsl_6 == 0),(char *)"Postcondition", + (char *)"(x == 2)",11); __gmpz_init_set_si((__mpz_struct *)(e_acsl_7),(long)y); e_acsl_8 = __gmpz_cmp((__mpz_struct const *)(e_acsl_7), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_8 == 0)) { e_acsl_fail((char *)"(y == 2)"); } + e_acsl_assert(! (e_acsl_8 == 0),(char *)"Postcondition", + (char *)"(y == 2)",12); __gmpz_clear((__mpz_struct *)(e_acsl_4)); __gmpz_clear((__mpz_struct *)(e_acsl_5)); __gmpz_clear((__mpz_struct *)(e_acsl_7)); @@ -96,7 +102,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_10),(long)2); e_acsl_11 = __gmpz_cmp((__mpz_struct const *)(e_acsl_9), (__mpz_struct const *)(e_acsl_10)); - if (! (e_acsl_11 == 0)) { e_acsl_fail((char *)"(x == 2)"); } + e_acsl_assert(! (e_acsl_11 == 0),(char *)"Precondition", + (char *)"(x == 2)",15); __gmpz_clear((__mpz_struct *)(e_acsl_9)); __gmpz_clear((__mpz_struct *)(e_acsl_10)); x ++; @@ -115,12 +122,14 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_13),(long)3); e_acsl_14 = __gmpz_cmp((__mpz_struct const *)(e_acsl_12), (__mpz_struct const *)(e_acsl_13)); - if (! (e_acsl_14 == 0)) { e_acsl_fail((char *)"(x == 3)"); } + e_acsl_assert(! (e_acsl_14 == 0),(char *)"Precondition", + (char *)"(x == 3)",18); __gmpz_init_set_si((__mpz_struct *)(e_acsl_15),(long)y); __gmpz_init_set_si((__mpz_struct *)(e_acsl_16),(long)2); e_acsl_17 = __gmpz_cmp((__mpz_struct const *)(e_acsl_15), (__mpz_struct const *)(e_acsl_16)); - if (! (e_acsl_17 == 0)) { e_acsl_fail((char *)"(y == 2)"); } + e_acsl_assert(! (e_acsl_17 == 0),(char *)"Precondition", + (char *)"(y == 2)",19); __gmpz_clear((__mpz_struct *)(e_acsl_12)); __gmpz_clear((__mpz_struct *)(e_acsl_13)); __gmpz_clear((__mpz_struct *)(e_acsl_15)); @@ -160,7 +169,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_19),(long)5); e_acsl_20 = __gmpz_cmp((__mpz_struct const *)(e_acsl_18), (__mpz_struct const *)(e_acsl_19)); - if (! (e_acsl_20 == 0)) { e_acsl_fail((char *)"(x == 5)"); } + e_acsl_assert(! (e_acsl_20 == 0),(char *)"Precondition", + (char *)"(x == 5)",23); __gmpz_init_set_si((__mpz_struct *)(e_acsl_21),(long)3); __gmpz_init_set_si((__mpz_struct *)(e_acsl_22),(long)y); __gmpz_init((__mpz_struct *)(e_acsl_23)); @@ -169,11 +179,13 @@ int main(void) (__mpz_struct const *)(e_acsl_22)); e_acsl_24 = __gmpz_cmp((__mpz_struct const *)(e_acsl_18), (__mpz_struct const *)(e_acsl_23)); - if (! (e_acsl_24 == 0)) { e_acsl_fail((char *)"(x == 3+y)"); } + e_acsl_assert(! (e_acsl_24 == 0),(char *)"Precondition", + (char *)"(x == 3+y)",26); __gmpz_init_set_si((__mpz_struct *)(e_acsl_25),(long)2); e_acsl_26 = __gmpz_cmp((__mpz_struct const *)(e_acsl_22), (__mpz_struct const *)(e_acsl_25)); - if (! (e_acsl_26 == 0)) { e_acsl_fail((char *)"(y == 2)"); } + e_acsl_assert(! (e_acsl_26 == 0),(char *)"Precondition", + (char *)"(y == 2)",27); __gmpz_clear((__mpz_struct *)(e_acsl_18)); __gmpz_clear((__mpz_struct *)(e_acsl_19)); __gmpz_clear((__mpz_struct *)(e_acsl_21)); @@ -187,7 +199,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_28),(long)3); e_acsl_29 = __gmpz_cmp((__mpz_struct const *)(e_acsl_27), (__mpz_struct const *)(e_acsl_28)); - if (! (e_acsl_29 == 0)) { e_acsl_fail((char *)"(x == 3)"); } + e_acsl_assert(! (e_acsl_29 == 0),(char *)"Postcondition", + (char *)"(x == 3)",24); __gmpz_init_set_si((__mpz_struct *)(e_acsl_30),(long)y); __gmpz_init_set_si((__mpz_struct *)(e_acsl_31),(long)1); __gmpz_init((__mpz_struct *)(e_acsl_32)); @@ -195,7 +208,8 @@ int main(void) (__mpz_struct const *)(e_acsl_31)); e_acsl_33 = __gmpz_cmp((__mpz_struct const *)(e_acsl_27), (__mpz_struct const *)(e_acsl_32)); - if (! (e_acsl_33 == 0)) { e_acsl_fail((char *)"(x == y+1)"); } + e_acsl_assert(! (e_acsl_33 == 0),(char *)"Postcondition", + (char *)"(x == y+1)",28); __gmpz_clear((__mpz_struct *)(e_acsl_27)); __gmpz_clear((__mpz_struct *)(e_acsl_28)); __gmpz_clear((__mpz_struct *)(e_acsl_30)); @@ -243,7 +257,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_37)); __gmpz_clear((__mpz_struct *)(e_acsl_38)); } - if (! e_acsl_40) { e_acsl_fail((char *)"(x == 1 ==> x == 0)"); } + e_acsl_assert(! e_acsl_40,(char *)"Precondition", + (char *)"(x == 1 ==> x == 0)",33); __gmpz_init_set_si((__mpz_struct *)(e_acsl_41),(long)3); e_acsl_42 = __gmpz_cmp((__mpz_struct const *)(e_acsl_34), (__mpz_struct const *)(e_acsl_41)); @@ -273,8 +288,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_47)); __gmpz_clear((__mpz_struct *)(e_acsl_48)); } - if (! e_acsl_50) { e_acsl_fail((char *)"(x == 3 && y == 2 ==> x == 3)"); - } + e_acsl_assert(! e_acsl_50,(char *)"Precondition", + (char *)"(x == 3 && y == 2 ==> x == 3)",37); e_acsl_51 = __gmpz_cmp((__mpz_struct const *)(e_acsl_34), (__mpz_struct const *)(e_acsl_41)); if (e_acsl_51 == 0) { @@ -312,9 +327,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_58)); __gmpz_clear((__mpz_struct *)(e_acsl_59)); } - if (! e_acsl_61) { - e_acsl_fail((char *)"(x == 3 && y == 2 ==> x+y == 5)"); - } + e_acsl_assert(! e_acsl_61,(char *)"Precondition", + (char *)"(x == 3 && y == 2 ==> x+y == 5)",38); __gmpz_clear((__mpz_struct *)(e_acsl_34)); __gmpz_clear((__mpz_struct *)(e_acsl_35)); __gmpz_clear((__mpz_struct *)(e_acsl_41)); @@ -330,7 +344,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_63),(long)5); e_acsl_64 = __gmpz_cmp((__mpz_struct const *)(e_acsl_62), (__mpz_struct const *)(e_acsl_63)); - if (! (e_acsl_64 == 0)) { e_acsl_fail((char *)"(x == 5)"); } + e_acsl_assert(! (e_acsl_64 == 0),(char *)"Precondition", + (char *)"(x == 5)",41); __gmpz_clear((__mpz_struct *)(e_acsl_62)); __gmpz_clear((__mpz_struct *)(e_acsl_63)); /*@ requires y ≡ 2; */ @@ -342,7 +357,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_66),(long)2); e_acsl_67 = __gmpz_cmp((__mpz_struct const *)(e_acsl_65), (__mpz_struct const *)(e_acsl_66)); - if (! (e_acsl_67 == 0)) { e_acsl_fail((char *)"(y == 2)"); } + e_acsl_assert(! (e_acsl_67 == 0),(char *)"Precondition", + (char *)"(y == 2)",42); __gmpz_clear((__mpz_struct *)(e_acsl_65)); __gmpz_clear((__mpz_struct *)(e_acsl_66)); x += y; @@ -363,7 +379,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_69),(long)7); e_acsl_70 = __gmpz_cmp((__mpz_struct const *)(e_acsl_68), (__mpz_struct const *)(e_acsl_69)); - if (! (e_acsl_70 == 0)) { e_acsl_fail((char *)"(x == 7)"); } + e_acsl_assert(! (e_acsl_70 == 0),(char *)"Precondition", + (char *)"(x == 7)",45); __gmpz_clear((__mpz_struct *)(e_acsl_68)); __gmpz_clear((__mpz_struct *)(e_acsl_69)); __retres = 0; @@ -373,7 +390,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_72),(long)7); e_acsl_73 = __gmpz_cmp((__mpz_struct const *)(e_acsl_71), (__mpz_struct const *)(e_acsl_72)); - if (! (e_acsl_73 == 0)) { e_acsl_fail((char *)"(x == 7)"); } + e_acsl_assert(! (e_acsl_73 == 0),(char *)"Postcondition", + (char *)"(x == 7)",46); __gmpz_clear((__mpz_struct *)(e_acsl_71)); __gmpz_clear((__mpz_struct *)(e_acsl_72)); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_true.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_true.c index 4e81852c13afffb8b200281fd52ef52cacb116ea..087319aa515b8f84bda4725d4bfa2db9be0f9dda 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_true.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_true.c @@ -5,10 +5,13 @@ extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -18,6 +21,7 @@ int main(void) int x; x = 0; /*@ assert \true; */ ; + e_acsl_assert(0,(char *)"Assertion",(char *)"(\\true)",8); __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_typedef.c b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_typedef.c index 4df98a9641bd485ff3ab3bcf7332345b748490d9..54168dccf3edcf6f032042eca72d5c7dc3c971ae 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_typedef.c +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/gen_typedef.c @@ -29,10 +29,13 @@ extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -50,7 +53,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)0); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(x == 0)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Assertion",(char *)"(x == 0)", + 10); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/integer_constant.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/integer_constant.res.oracle index 612808fe393949291fc4442f470bff79978af460..1fa8809880eba5c1d7ea16e63e8e64c398716305 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/integer_constant.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/integer_constant.res.oracle @@ -3,37 +3,44 @@ [value] Initial state computed [value] Values of globals at initialization PROJECT_FILE.i:229:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:230. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:233:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:234. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:236:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_str <- main. Called from PROJECT_FILE.i:240. -PROJECT_FILE.i:82:[value] Function __gmpz_init_set_str: postcondition got status valid. +PROJECT_FILE.i:86:[value] Function __gmpz_init_set_str: postcondition got status valid. [value] Done for function __gmpz_init_set_str [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:241. -PROJECT_FILE.i:115:[value] Function __gmpz_cmp: precondition got status valid. -PROJECT_FILE.i:116:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:119:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:120:[value] Function __gmpz_cmp: precondition got status valid. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:243. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:242. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:245. -PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. + Called from PROJECT_FILE.i:244. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_clear [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} x ∈ {0} @@ -63,10 +70,13 @@ extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -75,10 +85,10 @@ int main(void) int __retres; int x; /*@ assert 0 ≡ 0; */ ; - if (! (0 == 0)) { e_acsl_fail((char *)"(0 == 0)"); } + e_acsl_assert(! (0 == 0),(char *)"Assertion",(char *)"(0 == 0)",8); x = 0; /*@ assert 0 ≢ 1; */ ; - if (! (0 != 1)) { e_acsl_fail((char *)"(0 != 1)"); } + e_acsl_assert(! (0 != 1),(char *)"Assertion",(char *)"(0 != 1)",9); /*@ assert 1152921504606846975 ≡ 0xfffffffffffffff; */ ; { mpz_t e_acsl_1; @@ -86,9 +96,8 @@ int main(void) __gmpz_init_set_str((__mpz_struct *)(e_acsl_1),"1152921504606846975",10); e_acsl_2 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_1)); - if (! (e_acsl_2 == 0)) { - e_acsl_fail((char *)"(1152921504606846975 == 0xfffffffffffffff)"); - } + e_acsl_assert(! (e_acsl_2 == 0),(char *)"Assertion", + (char *)"(1152921504606846975 == 0xfffffffffffffff)",10); __gmpz_clear((__mpz_struct *)(e_acsl_1)); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/invariant.err.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/invariant.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/invariant.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/invariant.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..03d77a1902919b03e124d4638de9d8be135858b3 --- /dev/null +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/invariant.res.oracle @@ -0,0 +1,910 @@ +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value] Values of globals at initialization +PROJECT_FILE.i:233:[value] entering loop for the first time +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +PROJECT_FILE.i:82:[value] Function __gmpz_init_set_si: postcondition got status valid. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +PROJECT_FILE.i:119:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:120:[value] Function __gmpz_cmp: precondition got status valid. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +PROJECT_FILE.i:252:[value] assigning non deterministic value for the first time +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:242. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:243. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:244. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:249. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:250. +[value] Done for function __gmpz_init_set_si +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:257. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:251. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:258. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:259. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:253. +[value] Done for function __gmpz_clear +PROJECT_FILE.i:263:[value] warning: 2's complement assumed for overflow +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:254. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:265. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value] Values at end of function e_acsl_assert: +[value] Values at end of function main: + __retres ∈ {0} + x ∈ [--..--] +/* Generated by Frama-C */ +struct __anonstruct___mpz_struct_1 { + int _mp_alloc ; + int _mp_size ; + unsigned long *_mp_d ; +}; +typedef struct __anonstruct___mpz_struct_1 __mpz_struct; +typedef __mpz_struct mpz_t[1]; +/*@ ensures \valid(\old(z)); + assigns *z; + assigns *z \from n; */ +extern void __gmpz_init_set_si(__mpz_struct * /*[1]*/ z, long n); +/*@ requires \valid(x); + assigns *x; */ +extern void __gmpz_clear(__mpz_struct * /*[1]*/ x); +/*@ requires \valid(z1); + requires \valid(z2); + assigns \nothing; */ +extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, + __mpz_struct const * /*[1]*/ z2); +/*@ terminates \false; + ensures \false; + assigns \nothing; */ +extern void exit(int status); +/*@ assigns \nothing; */ +extern int printf(char const * , ...); +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) +{ + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } + return; +} + +int main(void) +{ + int __retres; + int x; + x = 0; + { + int i; + i = 0; + while (1) { + if (! (i < 10)) { break; } + /*@ invariant 0 ≤ i ∧ i < 10; */ ; + { + mpz_t e_acsl_1; + mpz_t e_acsl_2; + int e_acsl_3; + int e_acsl_7; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_1),(long)0); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)i); + e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), + (__mpz_struct const *)(e_acsl_2)); + if (e_acsl_3 <= 0) { + mpz_t e_acsl_4; + mpz_t e_acsl_5; + int e_acsl_6; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_4),(long)i); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)10); + e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), + (__mpz_struct const *)(e_acsl_5)); + e_acsl_7 = e_acsl_6 < 0; + __gmpz_clear((__mpz_struct *)(e_acsl_4)); + __gmpz_clear((__mpz_struct *)(e_acsl_5)); + } + else { e_acsl_7 = 0; } + e_acsl_assert(! e_acsl_7,(char *)"Invariant", + (char *)"(0 <= i && i < 10)",8); + __gmpz_clear((__mpz_struct *)(e_acsl_1)); + __gmpz_clear((__mpz_struct *)(e_acsl_2)); + } + + x += i; + /*@ invariant i ≤ x; */ ; + e_acsl_assert(! (i <= x),(char *)"Invariant",(char *)"(i <= x)",10); + i ++; + } + } + + __retres = 0; + return (__retres); +} + + diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/lazy.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/lazy.res.oracle index 48a7728e324ed647390416513a2ab174fd63b504..9e4b1bd346815c9c8c055b1c9533c6df26d1d15d 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/lazy.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/lazy.res.oracle @@ -5,15 +5,15 @@ PROJECT_FILE.i:232:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:238. -PROJECT_FILE.i:78:[value] Function __gmpz_init_set_si: postcondition got status valid. +PROJECT_FILE.i:82:[value] Function __gmpz_init_set_si: postcondition got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:239. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:240. -PROJECT_FILE.i:115:[value] Function __gmpz_cmp: precondition got status valid. -PROJECT_FILE.i:116:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:119:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:120:[value] Function __gmpz_cmp: precondition got status valid. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:245. @@ -27,22 +27,22 @@ PROJECT_FILE.i:116:[value] Function __gmpz_cmp: precondition got status valid. PROJECT_FILE.i:248:[value] assigning non deterministic value for the first time [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:249. -PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:250. [value] Done for function __gmpz_clear -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:253. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:254. [value] Done for function __gmpz_clear @@ -63,6 +63,10 @@ PROJECT_FILE.i:259:[value] Assertion got status valid. Called from PROJECT_FILE.i:273. [value] Done for function __gmpz_init_set_si PROJECT_FILE.i:274:[value] Assertion got status invalid (stopping propagation). +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:284. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:285. [value] Done for function __gmpz_clear @@ -94,16 +98,16 @@ PROJECT_FILE.i:290:[value] Assertion got status valid. [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:309. [value] Done for function __gmpz_clear -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:311. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:312. [value] Done for function __gmpz_clear @@ -124,6 +128,10 @@ PROJECT_FILE.i:317:[value] Assertion got status valid. Called from PROJECT_FILE.i:332. [value] Done for function __gmpz_init_set_si PROJECT_FILE.i:333:[value] Assertion got status invalid (stopping propagation). +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:342. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:343. [value] Done for function __gmpz_clear @@ -155,16 +163,16 @@ PROJECT_FILE.i:348:[value] Assertion got status valid. [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:367. [value] Done for function __gmpz_clear -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:369. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:370. [value] Done for function __gmpz_clear @@ -185,17 +193,339 @@ PROJECT_FILE.i:375:[value] Assertion got status valid. Called from PROJECT_FILE.i:390. [value] Done for function __gmpz_init_set_si PROJECT_FILE.i:391:[value] Assertion got status invalid (stopping propagation). +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:400. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:401. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:402. [value] Done for function __gmpz_clear +PROJECT_FILE.i:406:[value] Assertion got status unknown. +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:412. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:413. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:414. +[value] Done for function __gmpz_cmp +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:417. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:418. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:419. +[value] Done for function __gmpz_clear +PROJECT_FILE.i:423:[value] Assertion got status unknown. +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:429. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:430. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:431. +[value] Done for function __gmpz_cmp +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:434. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:435. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:436. +[value] Done for function __gmpz_clear +PROJECT_FILE.i:440:[value] Assertion got status unknown. +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:446. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:447. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:448. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:453. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:464. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:454. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:465. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:455. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:466. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:457. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:468. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:458. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:469. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:471. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:472. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:473. +[value] Done for function __gmpz_clear +PROJECT_FILE.i:477:[value] Assertion got status valid. +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:484. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:485. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:486. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:492. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:493. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:494. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:496. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:497. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:504. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:505. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:506. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:512. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:513. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:514. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:516. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:517. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:520. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:521. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:524. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:525. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:526. +[value] Done for function __gmpz_clear +PROJECT_FILE.i:530:[value] Assertion got status valid. +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:537. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:538. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:539. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:545. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:546. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:547. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:549. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:550. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:557. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:558. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:559. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:565. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:566. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:567. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:569. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:570. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:573. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:574. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:577. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:578. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:579. +[value] Done for function __gmpz_clear +PROJECT_FILE.i:583:[value] Assertion got status valid. +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:592. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:593. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:594. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:597. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:598. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:599. +[value] Done for function __gmpz_cmp +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:600. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:602. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:603. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:604. +[value] Done for function __gmpz_clear +PROJECT_FILE.i:608:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:615. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +PROJECT_FILE.i:620:[value] Assertion got status valid. +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:629. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:630. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:631. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:633. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:634. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:637. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} x ∈ {0} @@ -226,10 +556,13 @@ extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -263,7 +596,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_5)); } else { e_acsl_7 = 0; } - if (! e_acsl_7) { e_acsl_fail((char *)"(x == 0 && y == 1)"); } + e_acsl_assert(! e_acsl_7,(char *)"Assertion", + (char *)"(x == 0 && y == 1)",10); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } @@ -285,7 +619,7 @@ int main(void) int e_acsl_14; __gmpz_init_set_si((__mpz_struct *)(e_acsl_11),(long)y); /*@ assert 0 ≢ 0; */ ; - if (0 == 0) { e_acsl_fail((char *)"(0 == 0)"); } + e_acsl_assert(0 == 0,(char *)"Assertion",(char *)"(0 == 0)",11); e_acsl_12 = 1 / 0; __gmpz_init_set_si((__mpz_struct *)(e_acsl_13),(long)e_acsl_12); e_acsl_14 = __gmpz_cmp((__mpz_struct const *)(e_acsl_11), @@ -295,7 +629,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_13)); } else { e_acsl_15 = 0; } - if (! (! e_acsl_15)) { e_acsl_fail((char *)"(!(x != 0 && y == 1/0))"); } + e_acsl_assert(! (! e_acsl_15),(char *)"Assertion", + (char *)"(!(x != 0 && y == 1/0))",11); __gmpz_clear((__mpz_struct *)(e_acsl_8)); __gmpz_clear((__mpz_struct *)(e_acsl_9)); } @@ -323,7 +658,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_19)); __gmpz_clear((__mpz_struct *)(e_acsl_20)); } - if (! e_acsl_22) { e_acsl_fail((char *)"(y == 1 || x == 1)"); } + e_acsl_assert(! e_acsl_22,(char *)"Assertion", + (char *)"(y == 1 || x == 1)",12); __gmpz_clear((__mpz_struct *)(e_acsl_16)); __gmpz_clear((__mpz_struct *)(e_acsl_17)); } @@ -346,7 +682,7 @@ int main(void) int e_acsl_29; __gmpz_init_set_si((__mpz_struct *)(e_acsl_26),(long)y); /*@ assert 0 ≢ 0; */ ; - if (0 == 0) { e_acsl_fail((char *)"(0 == 0)"); } + e_acsl_assert(0 == 0,(char *)"Assertion",(char *)"(0 == 0)",13); e_acsl_27 = 1 / 0; __gmpz_init_set_si((__mpz_struct *)(e_acsl_28),(long)e_acsl_27); e_acsl_29 = __gmpz_cmp((__mpz_struct const *)(e_acsl_26), @@ -355,7 +691,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_26)); __gmpz_clear((__mpz_struct *)(e_acsl_28)); } - if (! e_acsl_30) { e_acsl_fail((char *)"(x == 0 || y == 1/0)"); } + e_acsl_assert(! e_acsl_30,(char *)"Assertion", + (char *)"(x == 0 || y == 1/0)",13); __gmpz_clear((__mpz_struct *)(e_acsl_23)); __gmpz_clear((__mpz_struct *)(e_acsl_24)); } @@ -383,7 +720,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_34)); __gmpz_clear((__mpz_struct *)(e_acsl_35)); } - if (! e_acsl_37) { e_acsl_fail((char *)"(x == 0 ==> y == 1)"); } + e_acsl_assert(! e_acsl_37,(char *)"Assertion", + (char *)"(x == 0 ==> y == 1)",14); __gmpz_clear((__mpz_struct *)(e_acsl_31)); __gmpz_clear((__mpz_struct *)(e_acsl_32)); } @@ -406,7 +744,7 @@ int main(void) int e_acsl_44; __gmpz_init_set_si((__mpz_struct *)(e_acsl_41),(long)y); /*@ assert 0 ≢ 0; */ ; - if (0 == 0) { e_acsl_fail((char *)"(0 == 0)"); } + e_acsl_assert(0 == 0,(char *)"Assertion",(char *)"(0 == 0)",15); e_acsl_42 = 1 / 0; __gmpz_init_set_si((__mpz_struct *)(e_acsl_43),(long)e_acsl_42); e_acsl_44 = __gmpz_cmp((__mpz_struct const *)(e_acsl_41), @@ -415,11 +753,263 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_41)); __gmpz_clear((__mpz_struct *)(e_acsl_43)); } - if (! e_acsl_45) { e_acsl_fail((char *)"(x == 1 ==> y == 1/0)"); } + e_acsl_assert(! e_acsl_45,(char *)"Assertion", + (char *)"(x == 1 ==> y == 1/0)",15); __gmpz_clear((__mpz_struct *)(e_acsl_38)); __gmpz_clear((__mpz_struct *)(e_acsl_39)); } + /*@ assert x≢0? x ≢ 0: y ≢ 0; */ ; + { + mpz_t e_acsl_46; + mpz_t e_acsl_47; + int e_acsl_48; + int e_acsl_49; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_46),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_47),(long)0); + e_acsl_48 = __gmpz_cmp((__mpz_struct const *)(e_acsl_46), + (__mpz_struct const *)(e_acsl_47)); + if (e_acsl_48 != 0) { e_acsl_49 = x != 0; } + else { e_acsl_49 = y != 0; } + e_acsl_assert(! e_acsl_49,(char *)"Assertion", + (char *)"(x!=0? x != 0: y != 0)",16); + __gmpz_clear((__mpz_struct *)(e_acsl_46)); + __gmpz_clear((__mpz_struct *)(e_acsl_47)); + } + + /*@ assert y≢0? y ≢ 0: x ≢ 0; */ ; + { + mpz_t e_acsl_50; + mpz_t e_acsl_51; + int e_acsl_52; + int e_acsl_53; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_50),(long)y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_51),(long)0); + e_acsl_52 = __gmpz_cmp((__mpz_struct const *)(e_acsl_50), + (__mpz_struct const *)(e_acsl_51)); + if (e_acsl_52 != 0) { e_acsl_53 = y != 0; } + else { e_acsl_53 = x != 0; } + e_acsl_assert(! e_acsl_53,(char *)"Assertion", + (char *)"(y!=0? y != 0: x != 0)",17); + __gmpz_clear((__mpz_struct *)(e_acsl_50)); + __gmpz_clear((__mpz_struct *)(e_acsl_51)); + } + + /*@ assert x≡1? x ≡ 18: x ≡ 0; */ ; + { + mpz_t e_acsl_54; + mpz_t e_acsl_55; + int e_acsl_56; + int e_acsl_63; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_54),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_55),(long)1); + e_acsl_56 = __gmpz_cmp((__mpz_struct const *)(e_acsl_54), + (__mpz_struct const *)(e_acsl_55)); + if (e_acsl_56 == 0) { + mpz_t e_acsl_57; + mpz_t e_acsl_58; + int e_acsl_59; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_57),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_58),(long)18); + e_acsl_59 = __gmpz_cmp((__mpz_struct const *)(e_acsl_57), + (__mpz_struct const *)(e_acsl_58)); + e_acsl_63 = e_acsl_59 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_57)); + __gmpz_clear((__mpz_struct *)(e_acsl_58)); + } + else { + mpz_t e_acsl_60; + mpz_t e_acsl_61; + int e_acsl_62; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_60),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_61),(long)0); + e_acsl_62 = __gmpz_cmp((__mpz_struct const *)(e_acsl_60), + (__mpz_struct const *)(e_acsl_61)); + e_acsl_63 = e_acsl_62 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_60)); + __gmpz_clear((__mpz_struct *)(e_acsl_61)); + } + e_acsl_assert(! e_acsl_63,(char *)"Assertion", + (char *)"(x==1? x == 18: x == 0)",18); + __gmpz_clear((__mpz_struct *)(e_acsl_54)); + __gmpz_clear((__mpz_struct *)(e_acsl_55)); + } + + /*@ assert x ≡ 2 ⇔ y ≡ 3; */ ; + { + mpz_t e_acsl_64; + mpz_t e_acsl_65; + int e_acsl_66; + int e_acsl_70; + int e_acsl_78; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_64),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_65),(long)2); + e_acsl_66 = __gmpz_cmp((__mpz_struct const *)(e_acsl_64), + (__mpz_struct const *)(e_acsl_65)); + if (! (e_acsl_66 == 0)) { e_acsl_70 = 1; } + else { + mpz_t e_acsl_67; + mpz_t e_acsl_68; + int e_acsl_69; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_67),(long)y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_68),(long)3); + e_acsl_69 = __gmpz_cmp((__mpz_struct const *)(e_acsl_67), + (__mpz_struct const *)(e_acsl_68)); + e_acsl_70 = e_acsl_69 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_67)); + __gmpz_clear((__mpz_struct *)(e_acsl_68)); + } + if (e_acsl_70) { + mpz_t e_acsl_71; + mpz_t e_acsl_72; + int e_acsl_73; + int e_acsl_77; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_71),(long)y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_72),(long)3); + e_acsl_73 = __gmpz_cmp((__mpz_struct const *)(e_acsl_71), + (__mpz_struct const *)(e_acsl_72)); + if (! (e_acsl_73 == 0)) { e_acsl_77 = 1; } + else { + mpz_t e_acsl_74; + mpz_t e_acsl_75; + int e_acsl_76; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_74),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_75),(long)2); + e_acsl_76 = __gmpz_cmp((__mpz_struct const *)(e_acsl_74), + (__mpz_struct const *)(e_acsl_75)); + e_acsl_77 = e_acsl_76 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_74)); + __gmpz_clear((__mpz_struct *)(e_acsl_75)); + } + e_acsl_78 = e_acsl_77; + __gmpz_clear((__mpz_struct *)(e_acsl_71)); + __gmpz_clear((__mpz_struct *)(e_acsl_72)); + } + else { e_acsl_78 = 0; } + e_acsl_assert(! e_acsl_78,(char *)"Assertion", + (char *)"(x == 2 <==> y == 3)",21); + __gmpz_clear((__mpz_struct *)(e_acsl_64)); + __gmpz_clear((__mpz_struct *)(e_acsl_65)); + } + + /*@ assert x ≡ 0 ⇔ y ≡ 1; */ ; + { + mpz_t e_acsl_79; + mpz_t e_acsl_80; + int e_acsl_81; + int e_acsl_85; + int e_acsl_93; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_79),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_80),(long)0); + e_acsl_81 = __gmpz_cmp((__mpz_struct const *)(e_acsl_79), + (__mpz_struct const *)(e_acsl_80)); + if (! (e_acsl_81 == 0)) { e_acsl_85 = 1; } + else { + mpz_t e_acsl_82; + mpz_t e_acsl_83; + int e_acsl_84; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_82),(long)y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_83),(long)1); + e_acsl_84 = __gmpz_cmp((__mpz_struct const *)(e_acsl_82), + (__mpz_struct const *)(e_acsl_83)); + e_acsl_85 = e_acsl_84 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_82)); + __gmpz_clear((__mpz_struct *)(e_acsl_83)); + } + if (e_acsl_85) { + mpz_t e_acsl_86; + mpz_t e_acsl_87; + int e_acsl_88; + int e_acsl_92; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_86),(long)y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_87),(long)1); + e_acsl_88 = __gmpz_cmp((__mpz_struct const *)(e_acsl_86), + (__mpz_struct const *)(e_acsl_87)); + if (! (e_acsl_88 == 0)) { e_acsl_92 = 1; } + else { + mpz_t e_acsl_89; + mpz_t e_acsl_90; + int e_acsl_91; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_89),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_90),(long)0); + e_acsl_91 = __gmpz_cmp((__mpz_struct const *)(e_acsl_89), + (__mpz_struct const *)(e_acsl_90)); + e_acsl_92 = e_acsl_91 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_89)); + __gmpz_clear((__mpz_struct *)(e_acsl_90)); + } + e_acsl_93 = e_acsl_92; + __gmpz_clear((__mpz_struct *)(e_acsl_86)); + __gmpz_clear((__mpz_struct *)(e_acsl_87)); + } + else { e_acsl_93 = 0; } + e_acsl_assert(! e_acsl_93,(char *)"Assertion", + (char *)"(x == 0 <==> y == 1)",22); + __gmpz_clear((__mpz_struct *)(e_acsl_79)); + __gmpz_clear((__mpz_struct *)(e_acsl_80)); + } + + /*@ assert ((x≢0? x: y)≢0) ≡ (x≡0); */ ; + { + mpz_t e_acsl_94; + mpz_t e_acsl_95; + int e_acsl_96; + int e_acsl_97; + mpz_t e_acsl_98; + int e_acsl_99; + int e_acsl_100; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_94),(long)x); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_95),(long)0); + e_acsl_96 = __gmpz_cmp((__mpz_struct const *)(e_acsl_94), + (__mpz_struct const *)(e_acsl_95)); + if (e_acsl_96 != 0) { e_acsl_97 = x; } + else { e_acsl_97 = y; } + __gmpz_init_set_si((__mpz_struct *)(e_acsl_98),(long)e_acsl_97); + e_acsl_99 = __gmpz_cmp((__mpz_struct const *)(e_acsl_98), + (__mpz_struct const *)(e_acsl_95)); + e_acsl_100 = __gmpz_cmp((__mpz_struct const *)(e_acsl_94), + (__mpz_struct const *)(e_acsl_95)); + e_acsl_assert(! ((e_acsl_99 != 0) == (e_acsl_100 == 0)), + (char *)"Assertion", + (char *)"(((x!=0? x: y)!=0) == (x==0))",25); + __gmpz_clear((__mpz_struct *)(e_acsl_94)); + __gmpz_clear((__mpz_struct *)(e_acsl_95)); + __gmpz_clear((__mpz_struct *)(e_acsl_98)); + } + + /*@ assert (x ≢ 0 ∧ y ≢ 0) ∨ y ≢ 0; */ ; + { int e_acsl_101; + int e_acsl_102; + if (x != 0) { e_acsl_101 = y != 0; } + else { e_acsl_101 = 0; } + if (e_acsl_101) { e_acsl_102 = 1; } + else { e_acsl_102 = y != 0; } + e_acsl_assert(! e_acsl_102,(char *)"Assertion", + (char *)"((x != 0 && y != 0) || y != 0)",26); + } + + /*@ assert (x ≢ 0 ∨ y ≢ 0) ∧ y ≡ 1; */ ; + { int e_acsl_103; + int e_acsl_107; + if (x != 0) { e_acsl_103 = 1; } + else { e_acsl_103 = y != 0; } + if (e_acsl_103) { + mpz_t e_acsl_104; + mpz_t e_acsl_105; + int e_acsl_106; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_104),(long)y); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_105),(long)1); + e_acsl_106 = __gmpz_cmp((__mpz_struct const *)(e_acsl_104), + (__mpz_struct const *)(e_acsl_105)); + e_acsl_107 = e_acsl_106 == 0; + __gmpz_clear((__mpz_struct *)(e_acsl_104)); + __gmpz_clear((__mpz_struct *)(e_acsl_105)); + } + else { e_acsl_107 = 0; } + e_acsl_assert(! e_acsl_107,(char *)"Assertion", + (char *)"((x != 0 || y != 0) && y == 1)",27); + } + __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/nested_code_annot.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/nested_code_annot.res.oracle index f86c268944d7f635a8f0128b691471ed786fd562..20b0c204edaeb050d0cebc8149aeacf48ecc0dfd 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/nested_code_annot.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/nested_code_annot.res.oracle @@ -3,166 +3,169 @@ [value] Initial state computed [value] Values of globals at initialization PROJECT_FILE.i:232:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:233. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:245. -PROJECT_FILE.i:78:[value] Function __gmpz_init_set_si: postcondition got status valid. +PROJECT_FILE.i:82:[value] Function __gmpz_init_set_si: postcondition got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:246. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:247. -PROJECT_FILE.i:115:[value] Function __gmpz_cmp: precondition got status valid. -PROJECT_FILE.i:116:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:119:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:120:[value] Function __gmpz_cmp: precondition got status valid. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:248. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:249. -PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:250. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:266. + Called from PROJECT_FILE.i:267. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:267. + Called from PROJECT_FILE.i:268. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:268. -[value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. Called from PROJECT_FILE.i:269. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] Done for function __gmpz_cmp +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:270. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:270. + Called from PROJECT_FILE.i:271. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:271. + Called from PROJECT_FILE.i:272. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:275. + Called from PROJECT_FILE.i:276. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:276. + Called from PROJECT_FILE.i:277. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:277. -[value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. Called from PROJECT_FILE.i:278. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] Done for function __gmpz_cmp +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:279. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:279. + Called from PROJECT_FILE.i:280. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:280. + Called from PROJECT_FILE.i:281. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:294. + Called from PROJECT_FILE.i:295. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:295. + Called from PROJECT_FILE.i:296. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:296. -[value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. Called from PROJECT_FILE.i:297. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] Done for function __gmpz_cmp +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:298. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:298. + Called from PROJECT_FILE.i:299. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:299. + Called from PROJECT_FILE.i:300. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:303. + Called from PROJECT_FILE.i:304. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:304. + Called from PROJECT_FILE.i:305. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:305. -[value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. Called from PROJECT_FILE.i:306. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] Done for function __gmpz_cmp +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:307. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:307. + Called from PROJECT_FILE.i:308. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:308. + Called from PROJECT_FILE.i:309. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:319. + Called from PROJECT_FILE.i:321. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:320. + Called from PROJECT_FILE.i:322. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:321. + Called from PROJECT_FILE.i:323. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:322. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:324. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:323. + Called from PROJECT_FILE.i:325. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:324. + Called from PROJECT_FILE.i:326. [value] Done for function __gmpz_clear [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} x ∈ {2} @@ -193,10 +196,13 @@ extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -208,7 +214,7 @@ int main(void) x = 0; y = 1; /*@ assert x < y; */ ; - if (! (x < y)) { e_acsl_fail((char *)"(x < y)"); } + e_acsl_assert(! (x < y),(char *)"Assertion",(char *)"(x < y)",8); /*@ requires x ≡ 0; ensures x ≥ 1; */ { @@ -223,12 +229,14 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)0); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(x == 0)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Precondition", + (char *)"(x == 0)",9); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); if (x) { /*@ assert \false; */ ; - e_acsl_fail((char *)"(\\false)"); } + e_acsl_assert(1,(char *)"Assertion",(char *)"(\\false)",12); + } else { /*@ requires x ≡ 0; ensures x ≡ 1; */ @@ -244,7 +252,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)0); e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_6 == 0)) { e_acsl_fail((char *)"(x == 0)"); } + e_acsl_assert(! (e_acsl_6 == 0),(char *)"Precondition", + (char *)"(x == 0)",14); __gmpz_clear((__mpz_struct *)(e_acsl_4)); __gmpz_clear((__mpz_struct *)(e_acsl_5)); x ++; @@ -254,7 +263,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_8),(long)1); e_acsl_9 = __gmpz_cmp((__mpz_struct const *)(e_acsl_7), (__mpz_struct const *)(e_acsl_8)); - if (! (e_acsl_9 == 0)) { e_acsl_fail((char *)"(x == 1)"); } + e_acsl_assert(! (e_acsl_9 == 0),(char *)"Postcondition", + (char *)"(x == 1)",15); __gmpz_clear((__mpz_struct *)(e_acsl_7)); __gmpz_clear((__mpz_struct *)(e_acsl_8)); } @@ -274,7 +284,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_11),(long)1); e_acsl_12 = __gmpz_cmp((__mpz_struct const *)(e_acsl_10), (__mpz_struct const *)(e_acsl_11)); - if (! (e_acsl_12 == 0)) { e_acsl_fail((char *)"(x == 1)"); } + e_acsl_assert(! (e_acsl_12 == 0),(char *)"Precondition", + (char *)"(x == 1)",18); __gmpz_clear((__mpz_struct *)(e_acsl_10)); __gmpz_clear((__mpz_struct *)(e_acsl_11)); x ++; @@ -284,7 +295,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_14),(long)2); e_acsl_15 = __gmpz_cmp((__mpz_struct const *)(e_acsl_13), (__mpz_struct const *)(e_acsl_14)); - if (! (e_acsl_15 == 0)) { e_acsl_fail((char *)"(x == 2)"); } + e_acsl_assert(! (e_acsl_15 == 0),(char *)"Postcondition", + (char *)"(x == 2)",19); __gmpz_clear((__mpz_struct *)(e_acsl_13)); __gmpz_clear((__mpz_struct *)(e_acsl_14)); } @@ -292,7 +304,8 @@ int main(void) } else { /*@ assert \false; */ ; - e_acsl_fail((char *)"(\\false)"); } + e_acsl_assert(1,(char *)"Assertion",(char *)"(\\false)",22); + } } } @@ -300,7 +313,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_17),(long)1); e_acsl_18 = __gmpz_cmp((__mpz_struct const *)(e_acsl_16), (__mpz_struct const *)(e_acsl_17)); - if (! (e_acsl_18 >= 0)) { e_acsl_fail((char *)"(x >= 1)"); } + e_acsl_assert(! (e_acsl_18 >= 0),(char *)"Postcondition", + (char *)"(x >= 1)",10); __gmpz_clear((__mpz_struct *)(e_acsl_16)); __gmpz_clear((__mpz_struct *)(e_acsl_17)); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/not.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/not.res.oracle index 7c8f936c3fe9dff70a8034f4184a4f222872e9f4..c705a23eac12c1e869994569ee606c4d1b330bb4 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/not.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/not.res.oracle @@ -3,9 +3,14 @@ [value] Initial state computed [value] Values of globals at initialization PROJECT_FILE.i:230:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:231. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} x ∈ {0} @@ -16,10 +21,13 @@ PROJECT_FILE.i:230:[value] Assertion got status valid. extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -29,10 +37,10 @@ int main(void) int x; x = 0; /*@ assert x ≡ 0; */ ; - if (! (x == 0)) { e_acsl_fail((char *)"(x == 0)"); } + e_acsl_assert(! (x == 0),(char *)"Assertion",(char *)"(x == 0)",7); if (x) { /*@ assert x ≢ 0; */ ; - if (! (x != 0)) { e_acsl_fail((char *)"(x != 0)"); } + e_acsl_assert(! (x != 0),(char *)"Assertion",(char *)"(x != 0)",8); } __retres = 0; return (__retres); diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/null.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/null.res.oracle index c1ac03952d2b442b0cc3dcf51948df61e64d6dda..ee3a88ffc98d1d025175b0b5faca2938dde660b5 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/null.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/null.res.oracle @@ -3,9 +3,14 @@ [value] Initial state computed [value] Values of globals at initialization PROJECT_FILE.i:228:[value] Assertion got status unknown. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:229. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} /* Generated by Frama-C */ @@ -15,10 +20,13 @@ PROJECT_FILE.i:228:[value] Assertion got status unknown. extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -26,9 +34,8 @@ int main(void) { int __retres; /*@ assert \null ≡ (void *)0; */ ; - if (! ((void *)0 == (void *)0)) { - e_acsl_fail((char *)"(\\null == (void *)0)"); - } + e_acsl_assert(! ((void *)0 == (void *)0),(char *)"Assertion", + (char *)"(\\null == (void *)0)",7); __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/other_constants.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/other_constants.res.oracle index 7ab45fc79d91dc777ffc7aa6a8b0b578d86e31f2..bb4a8ab3fcfd540faef05216514a8554ca3db116 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/other_constants.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/other_constants.res.oracle @@ -3,37 +3,44 @@ [value] Initial state computed [value] Values of globals at initialization PROJECT_FILE.i:232:[value] Assertion got status unknown. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:233. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert PROJECT_FILE.i:235:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:239. -PROJECT_FILE.i:78:[value] Function __gmpz_init_set_si: postcondition got status valid. +PROJECT_FILE.i:82:[value] Function __gmpz_init_set_si: postcondition got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:240. -PROJECT_FILE.i:115:[value] Function __gmpz_cmp: precondition got status valid. -PROJECT_FILE.i:116:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:119:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:120:[value] Function __gmpz_cmp: precondition got status valid. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:241. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:242. -PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_clear PROJECT_FILE.i:246:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:247. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} /* Generated by Frama-C */ @@ -66,10 +73,13 @@ extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -77,8 +87,8 @@ int main(void) { int __retres; /*@ assert "toto" ≢ "titi"; */ ; - if (! ("toto" != "titi")) { e_acsl_fail((char *)"(\"toto\" != \"titi\")"); - } + e_acsl_assert(! ("toto" != "titi"),(char *)"Assertion", + (char *)"(\"toto\" != \"titi\")",9); /*@ assert 'c' ≡ 'c'; */ ; { mpz_t e_acsl_1; @@ -86,12 +96,14 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_1),(long)'c'); e_acsl_2 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_1)); - if (! (e_acsl_2 == 0)) { e_acsl_fail((char *)"(\'c\' == \'c\')"); } + e_acsl_assert(! (e_acsl_2 == 0),(char *)"Assertion", + (char *)"(\'c\' == \'c\')",10); __gmpz_clear((__mpz_struct *)(e_acsl_1)); } /*@ assert false ≢ true; */ ; - if (! (false != true)) { e_acsl_fail((char *)"(false != true)"); } + e_acsl_assert(! (false != true),(char *)"Assertion", + (char *)"(false != true)",11); __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/ptr.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/ptr.res.oracle index b87c8ae5fe2c0935eb4e999c455008a90b361b6d..49be1ebf3bcdd3f14566064f7f139307799e5806 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/ptr.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/ptr.res.oracle @@ -18,30 +18,30 @@ tests/e-acsl-runtime/ptr.i:26:[e-acsl] warning: missing guard for ensuring that PROJECT_FILE.i:236:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:241. -PROJECT_FILE.i:78:[value] Function __gmpz_init_set_si: postcondition got status valid. +PROJECT_FILE.i:82:[value] Function __gmpz_init_set_si: postcondition got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:242. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:243. -PROJECT_FILE.i:115:[value] Function __gmpz_cmp: precondition got status valid. -PROJECT_FILE.i:116:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:119:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:120:[value] Function __gmpz_cmp: precondition got status valid. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:244. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:245. -PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:246. @@ -56,16 +56,16 @@ PROJECT_FILE.i:250:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:257. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:258. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:259. [value] Done for function __gmpz_clear @@ -82,16 +82,16 @@ PROJECT_FILE.i:264:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:271. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:272. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:273. [value] Done for function __gmpz_clear @@ -107,13 +107,13 @@ PROJECT_FILE.i:278:[value] Assertion got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. Called from PROJECT_FILE.i:293. -PROJECT_FILE.i:65:[value] Function __gmpz_init: postcondition got status valid. +PROJECT_FILE.i:69:[value] Function __gmpz_init: postcondition got status valid. [value] Done for function __gmpz_init [value] computing for function __gmpz_mul <- main. Called from PROJECT_FILE.i:294. -PROJECT_FILE.i:146:[value] Function __gmpz_mul: precondition got status valid. -PROJECT_FILE.i:147:[value] Function __gmpz_mul: precondition got status valid. -PROJECT_FILE.i:148:[value] Function __gmpz_mul: precondition got status valid. +PROJECT_FILE.i:150:[value] Function __gmpz_mul: precondition got status valid. +PROJECT_FILE.i:151:[value] Function __gmpz_mul: precondition got status valid. +PROJECT_FILE.i:152:[value] Function __gmpz_mul: precondition got status valid. [value] Done for function __gmpz_mul [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:295. @@ -128,25 +128,25 @@ PROJECT_FILE.i:148:[value] Function __gmpz_mul: precondition got status valid. Called from PROJECT_FILE.i:298. [value] Done for function __gmpz_init PROJECT_FILE.i:299:[value] Assertion got status valid. -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:300. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_tdiv_q <- main. Called from PROJECT_FILE.i:301. -PROJECT_FILE.i:152:[value] Function __gmpz_tdiv_q: precondition got status valid. -PROJECT_FILE.i:153:[value] Function __gmpz_tdiv_q: precondition got status valid. -PROJECT_FILE.i:154:[value] Function __gmpz_tdiv_q: precondition got status valid. +PROJECT_FILE.i:156:[value] Function __gmpz_tdiv_q: precondition got status valid. +PROJECT_FILE.i:157:[value] Function __gmpz_tdiv_q: precondition got status valid. +PROJECT_FILE.i:158:[value] Function __gmpz_tdiv_q: precondition got status valid. [value] Done for function __gmpz_tdiv_q [value] computing for function __gmpz_get_si <- main. Called from PROJECT_FILE.i:302. -PROJECT_FILE.i:168:[value] Function __gmpz_get_si: precondition got status valid. +PROJECT_FILE.i:172:[value] Function __gmpz_get_si: precondition got status valid. [value] Done for function __gmpz_get_si PROJECT_FILE.i:303:[kernel] warning: accessing out of bounds index [-2147483648..2147483647]. assert 0 ≤ e_acsl_17 ∧ e_acsl_17 < 3; @@ -159,16 +159,19 @@ PROJECT_FILE.i:303:[kernel] warning: accessing out of bounds index [-2147483648. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:305. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:307. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:306. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:308. +[value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:309. [value] Done for function __gmpz_clear @@ -190,42 +193,42 @@ PROJECT_FILE.i:303:[kernel] warning: accessing out of bounds index [-2147483648. [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:315. [value] Done for function __gmpz_clear -[value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:316. -[value] Done for function __gmpz_clear -PROJECT_FILE.i:323:[value] entering loop for the first time -PROJECT_FILE.i:326:[value] Assertion got status valid. +PROJECT_FILE.i:322:[value] entering loop for the first time +PROJECT_FILE.i:325:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:333. + Called from PROJECT_FILE.i:332. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:334. + Called from PROJECT_FILE.i:333. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:335. + Called from PROJECT_FILE.i:334. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:336. + Called from PROJECT_FILE.i:335. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:337. -PROJECT_FILE.i:134:[value] Function __gmpz_add: precondition got status valid. -PROJECT_FILE.i:135:[value] Function __gmpz_add: precondition got status valid. -PROJECT_FILE.i:136:[value] Function __gmpz_add: precondition got status valid. + Called from PROJECT_FILE.i:336. +PROJECT_FILE.i:138:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:139:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:140:[value] Function __gmpz_add: precondition got status valid. [value] Done for function __gmpz_add [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:338. + Called from PROJECT_FILE.i:337. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:339. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:338. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:339. +[value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:340. [value] Done for function __gmpz_clear @@ -235,55 +238,55 @@ PROJECT_FILE.i:136:[value] Function __gmpz_add: precondition got status valid. [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:342. [value] Done for function __gmpz_clear -[value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:343. -[value] Done for function __gmpz_clear -PROJECT_FILE.i:347:[value] Assertion got status valid. +PROJECT_FILE.i:346:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:357. + Called from PROJECT_FILE.i:356. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:358. + Called from PROJECT_FILE.i:357. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:359. + Called from PROJECT_FILE.i:358. [value] Done for function __gmpz_init [value] computing for function __gmpz_sub <- main. - Called from PROJECT_FILE.i:360. -PROJECT_FILE.i:140:[value] Function __gmpz_sub: precondition got status valid. -PROJECT_FILE.i:141:[value] Function __gmpz_sub: precondition got status valid. -PROJECT_FILE.i:142:[value] Function __gmpz_sub: precondition got status valid. + Called from PROJECT_FILE.i:359. +PROJECT_FILE.i:144:[value] Function __gmpz_sub: precondition got status valid. +PROJECT_FILE.i:145:[value] Function __gmpz_sub: precondition got status valid. +PROJECT_FILE.i:146:[value] Function __gmpz_sub: precondition got status valid. [value] Done for function __gmpz_sub [value] computing for function __gmpz_get_si <- main. - Called from PROJECT_FILE.i:361. + Called from PROJECT_FILE.i:360. [value] Done for function __gmpz_get_si -PROJECT_FILE.i:362:[kernel] warning: accessing out of bounds index [-2147483648..2147483647]. +PROJECT_FILE.i:361:[kernel] warning: accessing out of bounds index [-2147483648..2147483647]. assert 0 ≤ e_acsl_29 ∧ e_acsl_29 < 3; [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:362. + Called from PROJECT_FILE.i:361. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:363. + Called from PROJECT_FILE.i:362. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:364. + Called from PROJECT_FILE.i:363. [value] Done for function __gmpz_init [value] computing for function __gmpz_sub <- main. - Called from PROJECT_FILE.i:365. + Called from PROJECT_FILE.i:364. [value] Done for function __gmpz_sub [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:366. + Called from PROJECT_FILE.i:365. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:367. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:366. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:367. +[value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:368. [value] Done for function __gmpz_clear @@ -299,38 +302,35 @@ PROJECT_FILE.i:362:[kernel] warning: accessing out of bounds index [-2147483648. [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:372. [value] Done for function __gmpz_clear -[value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:373. -[value] Done for function __gmpz_clear -PROJECT_FILE.i:377:[value] Assertion got status valid. +PROJECT_FILE.i:376:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:384. + Called from PROJECT_FILE.i:383. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:385. + Called from PROJECT_FILE.i:384. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:386. + Called from PROJECT_FILE.i:385. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:387. + Called from PROJECT_FILE.i:386. [value] Done for function __gmpz_init [value] computing for function __gmpz_sub <- main. - Called from PROJECT_FILE.i:388. + Called from PROJECT_FILE.i:387. [value] Done for function __gmpz_sub [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:389. + Called from PROJECT_FILE.i:388. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:390. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:389. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:391. [value] Done for function __gmpz_clear @@ -343,35 +343,38 @@ PROJECT_FILE.i:377:[value] Assertion got status valid. [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:394. [value] Done for function __gmpz_clear -PROJECT_FILE.i:326:[value] Assertion got status unknown. +PROJECT_FILE.i:325:[value] Assertion got status unknown. [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:333. + Called from PROJECT_FILE.i:332. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:334. + Called from PROJECT_FILE.i:333. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:335. + Called from PROJECT_FILE.i:334. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:336. + Called from PROJECT_FILE.i:335. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:337. + Called from PROJECT_FILE.i:336. [value] Done for function __gmpz_add [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:338. + Called from PROJECT_FILE.i:337. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:339. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:338. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:339. +[value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:340. [value] Done for function __gmpz_clear @@ -381,51 +384,51 @@ PROJECT_FILE.i:326:[value] Assertion got status unknown. [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:342. [value] Done for function __gmpz_clear -[value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:343. -[value] Done for function __gmpz_clear -PROJECT_FILE.i:347:[value] Assertion got status unknown. +PROJECT_FILE.i:346:[value] Assertion got status unknown. [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:357. + Called from PROJECT_FILE.i:356. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:358. + Called from PROJECT_FILE.i:357. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:359. + Called from PROJECT_FILE.i:358. [value] Done for function __gmpz_init [value] computing for function __gmpz_sub <- main. - Called from PROJECT_FILE.i:360. + Called from PROJECT_FILE.i:359. [value] Done for function __gmpz_sub [value] computing for function __gmpz_get_si <- main. - Called from PROJECT_FILE.i:361. + Called from PROJECT_FILE.i:360. [value] Done for function __gmpz_get_si -PROJECT_FILE.i:362:[value] Assertion got status unknown. +PROJECT_FILE.i:361:[value] Assertion got status unknown. [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:362. + Called from PROJECT_FILE.i:361. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:363. + Called from PROJECT_FILE.i:362. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:364. + Called from PROJECT_FILE.i:363. [value] Done for function __gmpz_init [value] computing for function __gmpz_sub <- main. - Called from PROJECT_FILE.i:365. + Called from PROJECT_FILE.i:364. [value] Done for function __gmpz_sub [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:366. + Called from PROJECT_FILE.i:365. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:367. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:366. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:367. +[value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:368. [value] Done for function __gmpz_clear @@ -441,38 +444,35 @@ PROJECT_FILE.i:362:[value] Assertion got status unknown. [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:372. [value] Done for function __gmpz_clear -[value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:373. -[value] Done for function __gmpz_clear -PROJECT_FILE.i:377:[value] Assertion got status unknown. +PROJECT_FILE.i:376:[value] Assertion got status unknown. [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:384. + Called from PROJECT_FILE.i:383. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:385. + Called from PROJECT_FILE.i:384. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:386. + Called from PROJECT_FILE.i:385. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:387. + Called from PROJECT_FILE.i:386. [value] Done for function __gmpz_init [value] computing for function __gmpz_sub <- main. - Called from PROJECT_FILE.i:388. + Called from PROJECT_FILE.i:387. [value] Done for function __gmpz_sub [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:389. + Called from PROJECT_FILE.i:388. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:390. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:389. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:391. [value] Done for function __gmpz_clear @@ -496,16 +496,16 @@ PROJECT_FILE.i:404:[value] Assertion got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:411. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:412. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:413. [value] Done for function __gmpz_clear @@ -515,8 +515,7 @@ PROJECT_FILE.i:404:[value] Assertion got status valid. [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} x ∈ {1} @@ -588,10 +587,13 @@ extern long __gmpz_get_si(__mpz_struct const * /*[1]*/ z); extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -615,7 +617,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)1); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(*p == 1)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Assertion",(char *)"(*p == 1)", + 12); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } @@ -629,7 +632,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)2); e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_6 == 0)) { e_acsl_fail((char *)"(t[0] == 2)"); } + e_acsl_assert(! (e_acsl_6 == 0),(char *)"Assertion", + (char *)"(t[0] == 2)",13); __gmpz_clear((__mpz_struct *)(e_acsl_4)); __gmpz_clear((__mpz_struct *)(e_acsl_5)); } @@ -643,7 +647,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_8),(long)4); e_acsl_9 = __gmpz_cmp((__mpz_struct const *)(e_acsl_7), (__mpz_struct const *)(e_acsl_8)); - if (! (e_acsl_9 == 0)) { e_acsl_fail((char *)"(t[2] == 4)"); } + e_acsl_assert(! (e_acsl_9 == 0),(char *)"Assertion", + (char *)"(t[2] == 4)",14); __gmpz_clear((__mpz_struct *)(e_acsl_7)); __gmpz_clear((__mpz_struct *)(e_acsl_8)); } @@ -672,7 +677,8 @@ int main(void) (__mpz_struct const *)(e_acsl_14)); __gmpz_init((__mpz_struct *)(e_acsl_16)); /*@ assert sizeof((int)0x0) ≢ 0; */ ; - if (e_acsl_15 == 0) { e_acsl_fail((char *)"(sizeof((int)0x0) == 0)"); } + e_acsl_assert(e_acsl_15 == 0,(char *)"Assertion", + (char *)"(sizeof((int)0x0) == 0)",15); __gmpz_tdiv_q((__mpz_struct *)(e_acsl_16), (__mpz_struct const *)(e_acsl_12), (__mpz_struct const *)(e_acsl_13)); @@ -684,9 +690,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_19),(long)4); e_acsl_20 = __gmpz_cmp((__mpz_struct const *)(e_acsl_18), (__mpz_struct const *)(e_acsl_19)); - if (! (e_acsl_20 == 0)) { - e_acsl_fail((char *)"(t[(2*sizeof(int))/sizeof((int)0x0)] == 4)"); - } + e_acsl_assert(! (e_acsl_20 == 0),(char *)"Assertion", + (char *)"(t[(2*sizeof(int))/sizeof((int)0x0)] == 4)",15); __gmpz_clear((__mpz_struct *)(e_acsl_10)); __gmpz_clear((__mpz_struct *)(e_acsl_11)); __gmpz_clear((__mpz_struct *)(e_acsl_12)); @@ -718,7 +723,8 @@ int main(void) (__mpz_struct const *)(e_acsl_23)); e_acsl_25 = __gmpz_cmp((__mpz_struct const *)(e_acsl_21), (__mpz_struct const *)(e_acsl_24)); - if (! (e_acsl_25 == 0)) { e_acsl_fail((char *)"(t[i] == i+2)"); } + e_acsl_assert(! (e_acsl_25 == 0),(char *)"Assertion", + (char *)"(t[i] == i+2)",18); __gmpz_clear((__mpz_struct *)(e_acsl_21)); __gmpz_clear((__mpz_struct *)(e_acsl_22)); __gmpz_clear((__mpz_struct *)(e_acsl_23)); @@ -753,7 +759,8 @@ int main(void) (__mpz_struct const *)(e_acsl_27)); e_acsl_33 = __gmpz_cmp((__mpz_struct const *)(e_acsl_30), (__mpz_struct const *)(e_acsl_32)); - if (! (e_acsl_33 == 0)) { e_acsl_fail((char *)"(t[2-i] == 4-i)"); } + e_acsl_assert(! (e_acsl_33 == 0),(char *)"Assertion", + (char *)"(t[2-i] == 4-i)",19); __gmpz_clear((__mpz_struct *)(e_acsl_26)); __gmpz_clear((__mpz_struct *)(e_acsl_27)); __gmpz_clear((__mpz_struct *)(e_acsl_28)); @@ -778,8 +785,8 @@ int main(void) (__mpz_struct const *)(e_acsl_36)); e_acsl_38 = __gmpz_cmp((__mpz_struct const *)(e_acsl_34), (__mpz_struct const *)(e_acsl_37)); - if (! (e_acsl_38 == 0)) { e_acsl_fail((char *)"(*(&t[2]-i) == 4-i)"); - } + e_acsl_assert(! (e_acsl_38 == 0),(char *)"Assertion", + (char *)"(*(&t[2]-i) == 4-i)",20); __gmpz_clear((__mpz_struct *)(e_acsl_34)); __gmpz_clear((__mpz_struct *)(e_acsl_35)); __gmpz_clear((__mpz_struct *)(e_acsl_36)); @@ -801,7 +808,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_40),(long)5); e_acsl_41 = __gmpz_cmp((__mpz_struct const *)(e_acsl_39), (__mpz_struct const *)(e_acsl_40)); - if (! (e_acsl_41 == 0)) { e_acsl_fail((char *)"(*p == 5)"); } + e_acsl_assert(! (e_acsl_41 == 0),(char *)"Assertion",(char *)"(*p == 5)", + 26); __gmpz_clear((__mpz_struct *)(e_acsl_39)); __gmpz_clear((__mpz_struct *)(e_acsl_40)); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/quantif.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/quantif.res.oracle index cefa30ae81a9055272c7187b45674e636ba45fa9..57c33d7d44678fa2a4165654841488ef9ce168a8 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/quantif.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/quantif.res.oracle @@ -1,455 +1,709 @@ +:0:[e-acsl] warning: missing guard for ensuring that the given integer is C-representable [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value] Values of globals at initialization -PROJECT_FILE.i:230:[value] Assertion got status unknown. +PROJECT_FILE.i:228:[value] Assertion got status unknown. [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:235. -PROJECT_FILE.i:65:[value] Function __gmpz_init: postcondition got status valid. + Called from PROJECT_FILE.i:233. +PROJECT_FILE.i:69:[value] Function __gmpz_init: postcondition got status valid. [value] Done for function __gmpz_init [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:238. -PROJECT_FILE.i:78:[value] Function __gmpz_init_set_si: postcondition got status valid. + Called from PROJECT_FILE.i:236. +PROJECT_FILE.i:82:[value] Function __gmpz_init_set_si: postcondition got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_set <- main. - Called from PROJECT_FILE.i:239. -PROJECT_FILE.i:90:[value] Function __gmpz_set: precondition got status valid. -PROJECT_FILE.i:91:[value] Function __gmpz_set: precondition got status valid. + Called from PROJECT_FILE.i:237. +PROJECT_FILE.i:94:[value] Function __gmpz_set: precondition got status valid. +PROJECT_FILE.i:95:[value] Function __gmpz_set: precondition got status valid. [value] Done for function __gmpz_set [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:240. -PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. + Called from PROJECT_FILE.i:238. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_clear -PROJECT_FILE.i:243:[value] entering loop for the first time +PROJECT_FILE.i:241:[value] entering loop for the first time [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:247. + Called from PROJECT_FILE.i:245. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:248. -PROJECT_FILE.i:115:[value] Function __gmpz_cmp: precondition got status valid. -PROJECT_FILE.i:116:[value] Function __gmpz_cmp: precondition got status valid. + Called from PROJECT_FILE.i:246. +PROJECT_FILE.i:119:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:120:[value] Function __gmpz_cmp: precondition got status valid. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:250. + Called from PROJECT_FILE.i:248. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:257. + Called from PROJECT_FILE.i:255. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:258. + Called from PROJECT_FILE.i:256. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:263. + Called from PROJECT_FILE.i:261. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:268. + Called from PROJECT_FILE.i:266. [value] Done for function __gmpz_clear [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:264. + Called from PROJECT_FILE.i:262. [value] Done for function __gmpz_cmp -PROJECT_FILE.i:265:[value] assigning non deterministic value for the first time +PROJECT_FILE.i:263:[value] assigning non deterministic value for the first time [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:266. + Called from PROJECT_FILE.i:264. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:278. + Called from PROJECT_FILE.i:276. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:268. + Called from PROJECT_FILE.i:266. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:279. + Called from PROJECT_FILE.i:277. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:280. -PROJECT_FILE.i:134:[value] Function __gmpz_add: precondition got status valid. -PROJECT_FILE.i:135:[value] Function __gmpz_add: precondition got status valid. -PROJECT_FILE.i:136:[value] Function __gmpz_add: precondition got status valid. + Called from PROJECT_FILE.i:278. +PROJECT_FILE.i:138:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:139:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:140:[value] Function __gmpz_add: precondition got status valid. [value] Done for function __gmpz_add [value] computing for function __gmpz_set <- main. - Called from PROJECT_FILE.i:281. + Called from PROJECT_FILE.i:279. [value] Done for function __gmpz_set [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:282. + Called from PROJECT_FILE.i:280. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:283. + Called from PROJECT_FILE.i:281. [value] Done for function __gmpz_clear -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:289. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:286. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:291. + Called from PROJECT_FILE.i:289. [value] Done for function __gmpz_clear -PROJECT_FILE.i:295:[value] Assertion got status unknown. +PROJECT_FILE.i:293:[value] Assertion got status unknown. [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:300. + Called from PROJECT_FILE.i:298. [value] Done for function __gmpz_init [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:305. + Called from PROJECT_FILE.i:303. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:306. + Called from PROJECT_FILE.i:304. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:307. + Called from PROJECT_FILE.i:305. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:308. + Called from PROJECT_FILE.i:306. [value] Done for function __gmpz_add [value] computing for function __gmpz_set <- main. - Called from PROJECT_FILE.i:309. + Called from PROJECT_FILE.i:307. [value] Done for function __gmpz_set [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:310. + Called from PROJECT_FILE.i:308. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:311. + Called from PROJECT_FILE.i:309. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:312. + Called from PROJECT_FILE.i:310. [value] Done for function __gmpz_clear -PROJECT_FILE.i:315:[value] entering loop for the first time +PROJECT_FILE.i:313:[value] entering loop for the first time [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:319. + Called from PROJECT_FILE.i:317. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:320. + Called from PROJECT_FILE.i:318. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:322. + Called from PROJECT_FILE.i:320. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:328. + Called from PROJECT_FILE.i:326. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:329. + Called from PROJECT_FILE.i:327. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:330. + Called from PROJECT_FILE.i:328. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:340. + Called from PROJECT_FILE.i:338. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:341. + Called from PROJECT_FILE.i:339. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:342. + Called from PROJECT_FILE.i:340. [value] Done for function __gmpz_add [value] computing for function __gmpz_set <- main. - Called from PROJECT_FILE.i:343. + Called from PROJECT_FILE.i:341. [value] Done for function __gmpz_set [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:344. + Called from PROJECT_FILE.i:342. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:345. + Called from PROJECT_FILE.i:343. [value] Done for function __gmpz_clear -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:351. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:348. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:353. + Called from PROJECT_FILE.i:350. [value] Done for function __gmpz_clear -PROJECT_FILE.i:357:[value] Assertion got status unknown. +PROJECT_FILE.i:354:[value] Assertion got status unknown. [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:362. + Called from PROJECT_FILE.i:359. [value] Done for function __gmpz_init [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:367. + Called from PROJECT_FILE.i:364. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:368. + Called from PROJECT_FILE.i:365. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:369. + Called from PROJECT_FILE.i:366. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:370. + Called from PROJECT_FILE.i:367. [value] Done for function __gmpz_add [value] computing for function __gmpz_set <- main. - Called from PROJECT_FILE.i:371. + Called from PROJECT_FILE.i:368. [value] Done for function __gmpz_set [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:372. + Called from PROJECT_FILE.i:369. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:373. + Called from PROJECT_FILE.i:370. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:374. + Called from PROJECT_FILE.i:371. [value] Done for function __gmpz_clear -PROJECT_FILE.i:377:[value] entering loop for the first time +PROJECT_FILE.i:374:[value] entering loop for the first time [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:381. + Called from PROJECT_FILE.i:378. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:382. + Called from PROJECT_FILE.i:379. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:384. + Called from PROJECT_FILE.i:381. [value] Done for function __gmpz_clear -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:405. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:401. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:407. + Called from PROJECT_FILE.i:403. [value] Done for function __gmpz_clear -PROJECT_FILE.i:411:[value] Assertion got status unknown. +PROJECT_FILE.i:407:[value] Assertion got status unknown. [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:416. + Called from PROJECT_FILE.i:412. [value] Done for function __gmpz_init [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:419. + Called from PROJECT_FILE.i:415. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_set <- main. - Called from PROJECT_FILE.i:420. + Called from PROJECT_FILE.i:416. [value] Done for function __gmpz_set [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:421. + Called from PROJECT_FILE.i:417. [value] Done for function __gmpz_clear -PROJECT_FILE.i:424:[value] entering loop for the first time +PROJECT_FILE.i:420:[value] entering loop for the first time [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:428. + Called from PROJECT_FILE.i:424. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:429. + Called from PROJECT_FILE.i:425. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:431. + Called from PROJECT_FILE.i:427. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:437. + Called from PROJECT_FILE.i:433. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:438. + Called from PROJECT_FILE.i:434. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:439. + Called from PROJECT_FILE.i:435. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:449. + Called from PROJECT_FILE.i:445. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:450. + Called from PROJECT_FILE.i:446. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:451. + Called from PROJECT_FILE.i:447. [value] Done for function __gmpz_add [value] computing for function __gmpz_set <- main. - Called from PROJECT_FILE.i:452. + Called from PROJECT_FILE.i:448. [value] Done for function __gmpz_set [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:453. + Called from PROJECT_FILE.i:449. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:454. + Called from PROJECT_FILE.i:450. [value] Done for function __gmpz_clear -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:460. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:455. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:462. + Called from PROJECT_FILE.i:457. [value] Done for function __gmpz_clear -PROJECT_FILE.i:466:[value] Assertion got status unknown. +PROJECT_FILE.i:461:[value] Assertion got status unknown. [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:476. + Called from PROJECT_FILE.i:471. [value] Done for function __gmpz_init [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:477. + Called from PROJECT_FILE.i:472. [value] Done for function __gmpz_init [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:478. + Called from PROJECT_FILE.i:473. [value] Done for function __gmpz_init [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:481. + Called from PROJECT_FILE.i:476. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_set <- main. - Called from PROJECT_FILE.i:482. + Called from PROJECT_FILE.i:477. [value] Done for function __gmpz_set [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:483. + Called from PROJECT_FILE.i:478. [value] Done for function __gmpz_clear -PROJECT_FILE.i:486:[value] entering loop for the first time +PROJECT_FILE.i:481:[value] entering loop for the first time [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:490. + Called from PROJECT_FILE.i:485. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:491. + Called from PROJECT_FILE.i:486. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:493. + Called from PROJECT_FILE.i:488. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:498. + Called from PROJECT_FILE.i:493. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_set <- main. - Called from PROJECT_FILE.i:499. + Called from PROJECT_FILE.i:494. [value] Done for function __gmpz_set [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:500. + Called from PROJECT_FILE.i:495. [value] Done for function __gmpz_clear -PROJECT_FILE.i:503:[value] entering loop for the first time +PROJECT_FILE.i:498:[value] entering loop for the first time [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:507. + Called from PROJECT_FILE.i:502. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:508. + Called from PROJECT_FILE.i:503. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:510. + Called from PROJECT_FILE.i:505. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:515. + Called from PROJECT_FILE.i:510. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:574. + Called from PROJECT_FILE.i:569. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_set <- main. - Called from PROJECT_FILE.i:516. + Called from PROJECT_FILE.i:511. [value] Done for function __gmpz_set [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:575. + Called from PROJECT_FILE.i:570. [value] Done for function __gmpz_init [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:517. + Called from PROJECT_FILE.i:512. [value] Done for function __gmpz_clear [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:576. + Called from PROJECT_FILE.i:571. [value] Done for function __gmpz_add -PROJECT_FILE.i:520:[value] entering loop for the first time +PROJECT_FILE.i:515:[value] entering loop for the first time [value] computing for function __gmpz_set <- main. - Called from PROJECT_FILE.i:577. + Called from PROJECT_FILE.i:572. [value] Done for function __gmpz_set [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:578. + Called from PROJECT_FILE.i:573. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:579. + Called from PROJECT_FILE.i:574. [value] Done for function __gmpz_clear [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:523. + Called from PROJECT_FILE.i:518. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:532. + Called from PROJECT_FILE.i:527. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:533. + Called from PROJECT_FILE.i:528. [value] Done for function __gmpz_add [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:562. + Called from PROJECT_FILE.i:557. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:534. + Called from PROJECT_FILE.i:529. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:563. + Called from PROJECT_FILE.i:558. [value] Done for function __gmpz_init [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:535. + Called from PROJECT_FILE.i:530. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:564. + Called from PROJECT_FILE.i:559. [value] Done for function __gmpz_add [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:536. + Called from PROJECT_FILE.i:531. [value] Done for function __gmpz_add [value] computing for function __gmpz_set <- main. - Called from PROJECT_FILE.i:565. + Called from PROJECT_FILE.i:560. [value] Done for function __gmpz_set [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:537. + Called from PROJECT_FILE.i:532. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:566. + Called from PROJECT_FILE.i:561. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:538. + Called from PROJECT_FILE.i:533. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:567. + Called from PROJECT_FILE.i:562. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:539. + Called from PROJECT_FILE.i:534. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:540. + Called from PROJECT_FILE.i:535. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:545. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init <- main. + Called from PROJECT_FILE.i:546. +[value] Done for function __gmpz_init +[value] computing for function __gmpz_add <- main. + Called from PROJECT_FILE.i:547. +[value] Done for function __gmpz_add +[value] computing for function __gmpz_set <- main. + Called from PROJECT_FILE.i:548. +[value] Done for function __gmpz_set +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:549. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:550. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:579. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:582. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:583. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:584. +[value] Done for function __gmpz_clear +PROJECT_FILE.i:588:[value] Assertion got status unknown. +[value] computing for function __gmpz_init <- main. + Called from PROJECT_FILE.i:593. +[value] Done for function __gmpz_init +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:596. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_set <- main. + Called from PROJECT_FILE.i:597. +[value] Done for function __gmpz_set +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:598. +[value] Done for function __gmpz_clear +PROJECT_FILE.i:601:[value] entering loop for the first time +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:605. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:606. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:608. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:614. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:615. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:616. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:626. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init <- main. + Called from PROJECT_FILE.i:627. +[value] Done for function __gmpz_init +[value] computing for function __gmpz_add <- main. + Called from PROJECT_FILE.i:628. +[value] Done for function __gmpz_add +[value] computing for function __gmpz_set <- main. + Called from PROJECT_FILE.i:629. +[value] Done for function __gmpz_set +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:630. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:631. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:636. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +PROJECT_FILE.i:641:[value] Assertion got status unknown. +[value] computing for function __gmpz_init <- main. + Called from PROJECT_FILE.i:648. +[value] Done for function __gmpz_init +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:651. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_set <- main. + Called from PROJECT_FILE.i:652. +[value] Done for function __gmpz_set +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:653. +[value] Done for function __gmpz_clear +PROJECT_FILE.i:656:[value] entering loop for the first time +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:660. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:661. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:663. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:673. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_get_si <- main. + Called from PROJECT_FILE.i:674. +PROJECT_FILE.i:172:[value] Function __gmpz_get_si: precondition got status valid. +[value] Done for function __gmpz_get_si +[value] computing for function __gmpz_init <- main. + Called from PROJECT_FILE.i:675. +[value] Done for function __gmpz_init +PROJECT_FILE.i:676:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:677. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_tdiv_r <- main. + Called from PROJECT_FILE.i:678. +PROJECT_FILE.i:162:[value] Function __gmpz_tdiv_r: precondition got status valid. +PROJECT_FILE.i:163:[value] Function __gmpz_tdiv_r: precondition got status valid. +PROJECT_FILE.i:164:[value] Function __gmpz_tdiv_r: precondition got status valid. +[value] Done for function __gmpz_tdiv_r +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:679. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:680. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:745. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_init <- main. + Called from PROJECT_FILE.i:686. +[value] Done for function __gmpz_init +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:746. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:747. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:689. [value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_set <- main. + Called from PROJECT_FILE.i:690. +[value] Done for function __gmpz_set +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:691. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:757. +[value] Done for function __gmpz_init_set_si +PROJECT_FILE.i:694:[value] entering loop for the first time [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:551. + Called from PROJECT_FILE.i:758. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:552. + Called from PROJECT_FILE.i:759. [value] Done for function __gmpz_add [value] computing for function __gmpz_set <- main. - Called from PROJECT_FILE.i:553. + Called from PROJECT_FILE.i:760. [value] Done for function __gmpz_set +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:700. +[value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:554. + Called from PROJECT_FILE.i:761. [value] Done for function __gmpz_clear +[value] computing for function __gmpz_get_si <- main. + Called from PROJECT_FILE.i:701. +[value] Done for function __gmpz_get_si [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:555. + Called from PROJECT_FILE.i:762. [value] Done for function __gmpz_clear -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:585. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function __gmpz_init <- main. + Called from PROJECT_FILE.i:702. +[value] Done for function __gmpz_init +PROJECT_FILE.i:703:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:704. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +[value] computing for function __gmpz_tdiv_q <- main. + Called from PROJECT_FILE.i:705. +PROJECT_FILE.i:156:[value] Function __gmpz_tdiv_q: precondition got status valid. +PROJECT_FILE.i:157:[value] Function __gmpz_tdiv_q: precondition got status valid. +PROJECT_FILE.i:158:[value] Function __gmpz_tdiv_q: precondition got status valid. +[value] Done for function __gmpz_tdiv_q +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:706. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:709. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:710. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:717. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:743. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_init <- main. + Called from PROJECT_FILE.i:718. +[value] Done for function __gmpz_init +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:745. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_mul <- main. + Called from PROJECT_FILE.i:719. +PROJECT_FILE.i:150:[value] Function __gmpz_mul: precondition got status valid. +PROJECT_FILE.i:151:[value] Function __gmpz_mul: precondition got status valid. +PROJECT_FILE.i:152:[value] Function __gmpz_mul: precondition got status valid. +[value] Done for function __gmpz_mul +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:746. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_cmp <- main. + Called from PROJECT_FILE.i:720. +[value] Done for function __gmpz_cmp +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:747. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:721. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:722. +[value] Done for function __gmpz_clear +[value] computing for function __gmpz_init_set_si <- main. + Called from PROJECT_FILE.i:732. +[value] Done for function __gmpz_init_set_si +[value] computing for function __gmpz_init <- main. + Called from PROJECT_FILE.i:733. +[value] Done for function __gmpz_init +[value] computing for function __gmpz_add <- main. + Called from PROJECT_FILE.i:734. +[value] Done for function __gmpz_add +[value] computing for function __gmpz_set <- main. + Called from PROJECT_FILE.i:735. +[value] Done for function __gmpz_set [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:587. + Called from PROJECT_FILE.i:743. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:588. + Called from PROJECT_FILE.i:736. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:589. + Called from PROJECT_FILE.i:737. [value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:767. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. +[value] Done for function printf +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +[value] Done for function exit +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} - a ∈ {-1} /* Generated by Frama-C */ struct __anonstruct___mpz_struct_1 { int _mp_alloc ; @@ -486,24 +740,52 @@ extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, extern void __gmpz_add(__mpz_struct * /*[1]*/ z1, __mpz_struct const * /*[1]*/ z2, __mpz_struct const * /*[1]*/ z3); +/*@ requires \valid(z1); + requires \valid(z2); + requires \valid(z3); + assigns *z1; +*/ +extern void __gmpz_mul(__mpz_struct * /*[1]*/ z1, + __mpz_struct const * /*[1]*/ z2, + __mpz_struct const * /*[1]*/ z3); +/*@ requires \valid(z1); + requires \valid(z2); + requires \valid(z3); + assigns *z1; +*/ +extern void __gmpz_tdiv_q(__mpz_struct * /*[1]*/ z1, + __mpz_struct const * /*[1]*/ z2, + __mpz_struct const * /*[1]*/ z3); +/*@ requires \valid(z1); + requires \valid(z2); + requires \valid(z3); + assigns *z1; +*/ +extern void __gmpz_tdiv_r(__mpz_struct * /*[1]*/ z1, + __mpz_struct const * /*[1]*/ z2, + __mpz_struct const * /*[1]*/ z3); +/*@ requires \valid(z); + assigns \nothing; */ +extern long __gmpz_get_si(__mpz_struct const * /*[1]*/ z); /*@ terminates \false; ensures \false; assigns \nothing; */ extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } int main(void) { int __retres; - int a; - a = -1; /*@ assert ∀ ℤ x; 0 ≤ x ∧ x ≤ 1 ⇒ x ≡ 0 ∨ x ≡ 1; */ ; { mpz_t e_acsl_1; @@ -567,9 +849,9 @@ int main(void) } e_acsl_end_loop1: ; - if (! e_acsl_2) { - e_acsl_fail((char *)"(\\forall integer x; 0 <= x && x <= 1 ==> x == 0 || x == 1)"); - } + e_acsl_assert(! e_acsl_2,(char *)"Assertion", + (char *)"(\\forall integer x; 0 <= x && x <= 1 ==> x == 0 || x == 1)", + 10); __gmpz_clear((__mpz_struct *)(e_acsl_1)); } @@ -635,9 +917,9 @@ int main(void) } e_acsl_end_loop2: ; - if (! e_acsl_14) { - e_acsl_fail((char *)"(\\forall integer x; 0 < x && x <= 1 ==> x == 1)"); - } + e_acsl_assert(! e_acsl_14,(char *)"Assertion", + (char *)"(\\forall integer x; 0 < x && x <= 1 ==> x == 1)", + 11); __gmpz_clear((__mpz_struct *)(e_acsl_13)); } @@ -693,9 +975,9 @@ int main(void) } e_acsl_end_loop3: ; - if (! e_acsl_25) { - e_acsl_fail((char *)"(\\forall integer x; 0 < x && x < 1 ==> \\false)"); - } + e_acsl_assert(! e_acsl_25,(char *)"Assertion", + (char *)"(\\forall integer x; 0 < x && x < 1 ==> \\false)", + 12); __gmpz_clear((__mpz_struct *)(e_acsl_24)); } @@ -752,9 +1034,9 @@ int main(void) } e_acsl_end_loop4: ; - if (! e_acsl_34) { - e_acsl_fail((char *)"(\\forall integer x; 0 <= x && x < 1 ==> x == 0)"); - } + e_acsl_assert(! e_acsl_34,(char *)"Assertion", + (char *)"(\\forall integer x; 0 <= x && x < 1 ==> x == 0)", + 13); __gmpz_clear((__mpz_struct *)(e_acsl_33)); } @@ -768,9 +1050,9 @@ int main(void) mpz_t e_acsl_44; int e_acsl_45; e_acsl_45 = 1; - __gmpz_init((__mpz_struct *)(e_acsl_44)); - __gmpz_init((__mpz_struct *)(e_acsl_43)); __gmpz_init((__mpz_struct *)(e_acsl_42)); + __gmpz_init((__mpz_struct *)(e_acsl_43)); + __gmpz_init((__mpz_struct *)(e_acsl_44)); { mpz_t e_acsl_59; __gmpz_init_set_si((__mpz_struct *)(e_acsl_59),(long)0); @@ -895,14 +1177,221 @@ int main(void) } e_acsl_end_loop5: ; - if (! e_acsl_45) { - e_acsl_fail((char *)"(\\forall integer x, integer y, integer z;\n ((0 <= x && x < 2) && (0 <= y && y < 5)) && (0 <= z && z <= y) ==>\n x+z <= y+1)"); - } + e_acsl_assert(! e_acsl_45,(char *)"Assertion", + (char *)"(\\forall integer x, integer y, integer z;\n ((0 <= x && x < 2) && (0 <= y && y < 5)) && (0 <= z && z <= y) ==>\n x+z <= y+1)", + 17); __gmpz_clear((__mpz_struct *)(e_acsl_42)); __gmpz_clear((__mpz_struct *)(e_acsl_43)); __gmpz_clear((__mpz_struct *)(e_acsl_44)); } + /*@ assert ∃ int x; (0 ≤ x ∧ x < 10) ∧ x ≡ 5; */ ; + { + mpz_t e_acsl_64; + int e_acsl_65; + e_acsl_65 = 0; + __gmpz_init((__mpz_struct *)(e_acsl_64)); + { + mpz_t e_acsl_68; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_68),(long)0); + __gmpz_set((__mpz_struct *)(e_acsl_64), + (__mpz_struct const *)(e_acsl_68)); + __gmpz_clear((__mpz_struct *)(e_acsl_68)); + } + + while (1) { + { + mpz_t e_acsl_69; + int e_acsl_70; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_69),(long)10); + e_acsl_70 = __gmpz_cmp((__mpz_struct const *)(e_acsl_64), + (__mpz_struct const *)(e_acsl_69)); + if (! (e_acsl_70 < 0)) { break; } + __gmpz_clear((__mpz_struct *)(e_acsl_69)); + } + + { + mpz_t e_acsl_66; + int e_acsl_67; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_66),(long)5); + e_acsl_67 = __gmpz_cmp((__mpz_struct const *)(e_acsl_64), + (__mpz_struct const *)(e_acsl_66)); + __gmpz_clear((__mpz_struct *)(e_acsl_66)); + if (! (! (e_acsl_67 == 0))) { + e_acsl_65 = 1; + goto e_acsl_end_loop6; } + } + + { + mpz_t e_acsl_71; + mpz_t e_acsl_72; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_71),(long)((char)1)); + __gmpz_init((__mpz_struct *)(e_acsl_72)); + __gmpz_add((__mpz_struct *)(e_acsl_72), + (__mpz_struct const *)(e_acsl_64), + (__mpz_struct const *)(e_acsl_71)); + __gmpz_set((__mpz_struct *)(e_acsl_64), + (__mpz_struct const *)(e_acsl_72)); + __gmpz_clear((__mpz_struct *)(e_acsl_71)); + __gmpz_clear((__mpz_struct *)(e_acsl_72)); + } + + } + e_acsl_end_loop6: ; + e_acsl_assert(! e_acsl_65,(char *)"Assertion", + (char *)"(\\exists int x; (0 <= x && x < 10) && x == 5)", + 22); + } + + /*@ + assert ∀ int x; 0 ≤ x ∧ x < 10 ⇒ + (x%2 ≡ 0 ⇒ (∃ ℤ y; (0 ≤ y ∧ y ≤ x/2) ∧ x ≡ 2*y)); */ ; + { + mpz_t e_acsl_73; + int e_acsl_74; + e_acsl_74 = 1; + __gmpz_init((__mpz_struct *)(e_acsl_73)); + { + mpz_t e_acsl_93; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_93),(long)0); + __gmpz_set((__mpz_struct *)(e_acsl_73), + (__mpz_struct const *)(e_acsl_93)); + __gmpz_clear((__mpz_struct *)(e_acsl_93)); + } + + while (1) { + { + mpz_t e_acsl_94; + int e_acsl_95; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_94),(long)10); + e_acsl_95 = __gmpz_cmp((__mpz_struct const *)(e_acsl_73), + (__mpz_struct const *)(e_acsl_94)); + if (! (e_acsl_95 < 0)) { break; } + __gmpz_clear((__mpz_struct *)(e_acsl_94)); + } + + { + mpz_t e_acsl_75; + int e_acsl_76; + mpz_t e_acsl_77; + mpz_t e_acsl_78; + int e_acsl_79; + int e_acsl_92; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_75),(long)2); + e_acsl_76 = (int)__gmpz_get_si((__mpz_struct const *)(e_acsl_75)); + __gmpz_init((__mpz_struct *)(e_acsl_77)); + /*@ assert 2 ≢ 0; */ ; + e_acsl_assert(e_acsl_76 == 0,(char *)"Assertion",(char *)"(2 == 0)", + 27); + __gmpz_tdiv_r((__mpz_struct *)(e_acsl_77), + (__mpz_struct const *)(e_acsl_73), + (__mpz_struct const *)(e_acsl_75)); + __gmpz_init_set_si((__mpz_struct *)(e_acsl_78),(long)0); + e_acsl_79 = __gmpz_cmp((__mpz_struct const *)(e_acsl_77), + (__mpz_struct const *)(e_acsl_78)); + if (! (e_acsl_79 == 0)) { e_acsl_92 = 1; } + else { + mpz_t e_acsl_80; + int e_acsl_81; + e_acsl_81 = 0; + __gmpz_init((__mpz_struct *)(e_acsl_80)); + { + mpz_t e_acsl_85; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_85),(long)0); + __gmpz_set((__mpz_struct *)(e_acsl_80), + (__mpz_struct const *)(e_acsl_85)); + __gmpz_clear((__mpz_struct *)(e_acsl_85)); + } + + while (1) { + { + mpz_t e_acsl_86; + int e_acsl_87; + mpz_t e_acsl_88; + int e_acsl_89; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_86),(long)2); + e_acsl_87 = (int)__gmpz_get_si((__mpz_struct const *)(e_acsl_86)); + __gmpz_init((__mpz_struct *)(e_acsl_88)); + /*@ assert 2 ≢ 0; */ ; + e_acsl_assert(e_acsl_87 == 0,(char *)"Assertion", + (char *)"(2 == 0)",27); + __gmpz_tdiv_q((__mpz_struct *)(e_acsl_88), + (__mpz_struct const *)(e_acsl_73), + (__mpz_struct const *)(e_acsl_86)); + e_acsl_89 = __gmpz_cmp((__mpz_struct const *)(e_acsl_80), + (__mpz_struct const *)(e_acsl_88)); + if (! (e_acsl_89 <= 0)) { break; } + __gmpz_clear((__mpz_struct *)(e_acsl_86)); + __gmpz_clear((__mpz_struct *)(e_acsl_88)); + } + + { + mpz_t e_acsl_82; + mpz_t e_acsl_83; + int e_acsl_84; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_82),(long)2); + __gmpz_init((__mpz_struct *)(e_acsl_83)); + __gmpz_mul((__mpz_struct *)(e_acsl_83), + (__mpz_struct const *)(e_acsl_82), + (__mpz_struct const *)(e_acsl_80)); + e_acsl_84 = __gmpz_cmp((__mpz_struct const *)(e_acsl_73), + (__mpz_struct const *)(e_acsl_83)); + __gmpz_clear((__mpz_struct *)(e_acsl_82)); + __gmpz_clear((__mpz_struct *)(e_acsl_83)); + if (! (! (e_acsl_84 == 0))) { + e_acsl_81 = 1; + goto e_acsl_end_loop7; + } + } + + { + mpz_t e_acsl_90; + mpz_t e_acsl_91; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_90),(long)((char)1)); + __gmpz_init((__mpz_struct *)(e_acsl_91)); + __gmpz_add((__mpz_struct *)(e_acsl_91), + (__mpz_struct const *)(e_acsl_80), + (__mpz_struct const *)(e_acsl_90)); + __gmpz_set((__mpz_struct *)(e_acsl_80), + (__mpz_struct const *)(e_acsl_91)); + __gmpz_clear((__mpz_struct *)(e_acsl_90)); + __gmpz_clear((__mpz_struct *)(e_acsl_91)); + } + + } + e_acsl_end_loop7: ; + e_acsl_92 = e_acsl_81; + __gmpz_clear((__mpz_struct *)(e_acsl_80)); + } + __gmpz_clear((__mpz_struct *)(e_acsl_75)); + __gmpz_clear((__mpz_struct *)(e_acsl_77)); + __gmpz_clear((__mpz_struct *)(e_acsl_78)); + if (! e_acsl_92) { + e_acsl_74 = 0; + goto e_acsl_end_loop8; } + } + + { + mpz_t e_acsl_96; + mpz_t e_acsl_97; + __gmpz_init_set_si((__mpz_struct *)(e_acsl_96),(long)((char)1)); + __gmpz_init((__mpz_struct *)(e_acsl_97)); + __gmpz_add((__mpz_struct *)(e_acsl_97), + (__mpz_struct const *)(e_acsl_73), + (__mpz_struct const *)(e_acsl_96)); + __gmpz_set((__mpz_struct *)(e_acsl_73), + (__mpz_struct const *)(e_acsl_97)); + __gmpz_clear((__mpz_struct *)(e_acsl_96)); + __gmpz_clear((__mpz_struct *)(e_acsl_97)); + } + + } + e_acsl_end_loop8: ; + e_acsl_assert(! e_acsl_74,(char *)"Assertion", + (char *)"(\\forall int x; 0 <= x && x < 10 ==>\n (x%2 == 0 ==> (\\exists integer y; (0 <= y && y <= x/2) && x == 2*y)))", + 26); + } + __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/result.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/result.res.oracle index 73b4c1240a2e9832bb440b414c2d36955313a390..40197acd721086a5a0d6be55ccd053e985200dc2 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/result.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/result.res.oracle @@ -5,93 +5,96 @@ tests/e-acsl-runtime/result.i:6:[e-acsl] warning: missing guard for ensuring tha [value] Values of globals at initialization Y ∈ {1} [value] computing for function f <- main. - Called from PROJECT_FILE.i:282. + Called from PROJECT_FILE.i:281. [value] computing for function __gmpz_init_set_si <- f <- main. Called from PROJECT_FILE.i:237. -PROJECT_FILE.i:78:[value] Function __gmpz_init_set_si: postcondition got status valid. +PROJECT_FILE.i:82:[value] Function __gmpz_init_set_si: postcondition got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- f <- main. Called from PROJECT_FILE.i:238. -PROJECT_FILE.i:65:[value] Function __gmpz_init: postcondition got status valid. +PROJECT_FILE.i:69:[value] Function __gmpz_init: postcondition got status valid. [value] Done for function __gmpz_init [value] computing for function __gmpz_sub <- f <- main. Called from PROJECT_FILE.i:239. -PROJECT_FILE.i:140:[value] Function __gmpz_sub: precondition got status valid. -PROJECT_FILE.i:141:[value] Function __gmpz_sub: precondition got status valid. -PROJECT_FILE.i:142:[value] Function __gmpz_sub: precondition got status valid. +PROJECT_FILE.i:144:[value] Function __gmpz_sub: precondition got status valid. +PROJECT_FILE.i:145:[value] Function __gmpz_sub: precondition got status valid. +PROJECT_FILE.i:146:[value] Function __gmpz_sub: precondition got status valid. [value] Done for function __gmpz_sub [value] computing for function __gmpz_get_si <- f <- main. Called from PROJECT_FILE.i:240. -PROJECT_FILE.i:168:[value] Function __gmpz_get_si: precondition got status valid. +PROJECT_FILE.i:172:[value] Function __gmpz_get_si: precondition got status valid. [value] Done for function __gmpz_get_si -[value] computing for function e_acsl_fail <- f <- main. - Called from PROJECT_FILE.i:242. -[value] computing for function printf <- e_acsl_fail <- f <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:241. +[value] computing for function printf <- e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- f <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- f <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- f <- main. - Called from PROJECT_FILE.i:244. -PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. + Called from PROJECT_FILE.i:243. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- f <- main. - Called from PROJECT_FILE.i:245. + Called from PROJECT_FILE.i:244. [value] Done for function __gmpz_clear PROJECT_FILE.i:225:[value] Function f: postcondition got status valid. [value] Recording results for f [value] Done for function f [value] computing for function g <- main. - Called from PROJECT_FILE.i:283. -PROJECT_FILE.i:252:[value] Function g: postcondition got status valid. + Called from PROJECT_FILE.i:282. +[value] computing for function e_acsl_assert <- g <- main. + Called from PROJECT_FILE.i:254. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert +PROJECT_FILE.i:251:[value] Function g: postcondition got status valid. [value] Recording results for g [value] Done for function g [value] computing for function h <- main. - Called from PROJECT_FILE.i:284. + Called from PROJECT_FILE.i:283. [value] computing for function __gmpz_init_set_si <- h <- main. - Called from PROJECT_FILE.i:268. + Called from PROJECT_FILE.i:267. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- h <- main. - Called from PROJECT_FILE.i:269. + Called from PROJECT_FILE.i:268. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- h <- main. - Called from PROJECT_FILE.i:270. -PROJECT_FILE.i:115:[value] Function __gmpz_cmp: precondition got status valid. -PROJECT_FILE.i:116:[value] Function __gmpz_cmp: precondition got status valid. + Called from PROJECT_FILE.i:269. +PROJECT_FILE.i:119:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:120:[value] Function __gmpz_cmp: precondition got status valid. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- h <- main. - Called from PROJECT_FILE.i:271. -[value] computing for function printf <- e_acsl_fail <- h <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- h <- main. + Called from PROJECT_FILE.i:270. +[value] computing for function printf <- e_acsl_assert <- h <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- h <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- h <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- h <- main. - Called from PROJECT_FILE.i:272. + Called from PROJECT_FILE.i:271. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- h <- main. - Called from PROJECT_FILE.i:273. + Called from PROJECT_FILE.i:272. [value] Done for function __gmpz_clear -PROJECT_FILE.i:259:[value] Function h: postcondition got status valid. +PROJECT_FILE.i:258:[value] Function h: postcondition got status valid. [value] Recording results for h [value] Done for function h [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function g: -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function f: x ∈ {0} e_acsl_1 ∈ {1} e_acsl_3 ∈ {1} +[value] Values at end of function g: [value] Values at end of function h: __retres ∈ {0} [value] Values at end of function main: @@ -136,10 +139,13 @@ extern long __gmpz_get_si(__mpz_struct const * /*[1]*/ z); extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -160,9 +166,8 @@ int f(int x) __gmpz_sub((__mpz_struct *)(e_acsl_4),(__mpz_struct const *)(e_acsl_2), (__mpz_struct const *)(e_acsl_2)); e_acsl_5 = (int)__gmpz_get_si((__mpz_struct const *)(e_acsl_4)); - if (! (x == e_acsl_5)) { - e_acsl_fail((char *)"(\\result == (int)(\\old(x)-\\old(x)))"); - } + e_acsl_assert(! (x == e_acsl_5),(char *)"Postcondition", + (char *)"(\\result == (int)(\\old(x)-\\old(x)))",6); __gmpz_clear((__mpz_struct *)(e_acsl_2)); __gmpz_clear((__mpz_struct *)(e_acsl_4)); return (x); @@ -174,7 +179,8 @@ int Y = 1; /*@ ensures \result ≡ Y; */ int g(int x) { - if (! (x == Y)) { e_acsl_fail((char *)"(\\result == Y)"); } + e_acsl_assert(! (x == Y),(char *)"Postcondition",(char *)"(\\result == Y)", + 17); return (x); } @@ -191,7 +197,8 @@ int h(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)0); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(\\result == 0)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Postcondition", + (char *)"(\\result == 0)",22); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); return (__retres); diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/sizeof.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/sizeof.res.oracle index 36a661cff89fcef0b9ad4b21e830111d0ff05f4e..edf627c0a5163f784896bd2d9b6e07912f78c990 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/sizeof.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/sizeof.res.oracle @@ -5,54 +5,54 @@ PROJECT_FILE.i:230:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:235. -PROJECT_FILE.i:78:[value] Function __gmpz_init_set_si: postcondition got status valid. +PROJECT_FILE.i:82:[value] Function __gmpz_init_set_si: postcondition got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:236. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:237. -PROJECT_FILE.i:115:[value] Function __gmpz_cmp: precondition got status valid. -PROJECT_FILE.i:116:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:119:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:120:[value] Function __gmpz_cmp: precondition got status valid. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:238. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:239. -PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. + Called from PROJECT_FILE.i:240. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:240. + Called from PROJECT_FILE.i:241. [value] Done for function __gmpz_clear -PROJECT_FILE.i:244:[value] Assertion got status valid. +PROJECT_FILE.i:245:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:249. + Called from PROJECT_FILE.i:250. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:250. + Called from PROJECT_FILE.i:251. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:251. + Called from PROJECT_FILE.i:252. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:253. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:255. [value] Done for function __gmpz_clear @@ -62,8 +62,7 @@ PROJECT_FILE.i:244:[value] Assertion got status valid. [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} x ∈ {0} @@ -93,10 +92,13 @@ extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -114,9 +116,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)4); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { - e_acsl_fail((char *)"(sizeof(int) == sizeof(x))"); - } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Assertion", + (char *)"(sizeof(int) == sizeof(x))",8); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } @@ -130,9 +131,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)4); e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_6 == 0)) { - e_acsl_fail((char *)"(sizeof(\"totototototo\") == sizeof(char *))"); - } + e_acsl_assert(! (e_acsl_6 == 0),(char *)"Assertion", + (char *)"(sizeof(\"totototototo\") == sizeof(char *))",9); __gmpz_clear((__mpz_struct *)(e_acsl_4)); __gmpz_clear((__mpz_struct *)(e_acsl_5)); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/stmt_contract.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/stmt_contract.res.oracle index 638ac44d5a5389caf47a4d3b43dffbf84e4ab5d3..a0be93df8876ffd8ee822af36fb0e8eca51b1bc6 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/stmt_contract.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/stmt_contract.res.oracle @@ -4,30 +4,30 @@ [value] Values of globals at initialization [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:238. -PROJECT_FILE.i:78:[value] Function __gmpz_init_set_si: postcondition got status valid. +PROJECT_FILE.i:82:[value] Function __gmpz_init_set_si: postcondition got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:239. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:240. -PROJECT_FILE.i:115:[value] Function __gmpz_cmp: precondition got status valid. -PROJECT_FILE.i:116:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:119:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:120:[value] Function __gmpz_cmp: precondition got status valid. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:241. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:242. -PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:243. @@ -41,32 +41,32 @@ PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:257. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:258. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:259. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:260. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:261. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:262. [value] Done for function __gmpz_clear @@ -85,16 +85,16 @@ PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:274. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:275. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:276. [value] Done for function __gmpz_clear @@ -110,16 +110,16 @@ PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:292. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:293. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:294. [value] Done for function __gmpz_init_set_si @@ -129,16 +129,16 @@ PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:296. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:297. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:298. [value] Done for function __gmpz_clear @@ -160,16 +160,16 @@ PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:335. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:336. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:337. [value] Done for function __gmpz_init_set_si @@ -178,43 +178,43 @@ PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. Called from PROJECT_FILE.i:339. -PROJECT_FILE.i:65:[value] Function __gmpz_init: postcondition got status valid. +PROJECT_FILE.i:69:[value] Function __gmpz_init: postcondition got status valid. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. Called from PROJECT_FILE.i:340. -PROJECT_FILE.i:134:[value] Function __gmpz_add: precondition got status valid. -PROJECT_FILE.i:135:[value] Function __gmpz_add: precondition got status valid. -PROJECT_FILE.i:136:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:138:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:139:[value] Function __gmpz_add: precondition got status valid. +PROJECT_FILE.i:140:[value] Function __gmpz_add: precondition got status valid. [value] Done for function __gmpz_add [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:341. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:342. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:343. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:344. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:345. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:346. [value] Done for function __gmpz_clear @@ -242,16 +242,16 @@ PROJECT_FILE.i:136:[value] Function __gmpz_add: precondition got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:357. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:358. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:359. [value] Done for function __gmpz_init_set_si @@ -267,16 +267,16 @@ PROJECT_FILE.i:136:[value] Function __gmpz_add: precondition got status valid. [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:363. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:364. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:365. [value] Done for function __gmpz_clear @@ -317,16 +317,16 @@ PROJECT_FILE.i:406:[value] assigning non deterministic value for the first time [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:408. [value] Done for function __gmpz_clear -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:410. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:411. [value] Done for function __gmpz_init_set_si @@ -363,55 +363,52 @@ PROJECT_FILE.i:406:[value] assigning non deterministic value for the first time [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:435. [value] Done for function __gmpz_clear -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:437. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:438. + Called from PROJECT_FILE.i:439. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:443. + Called from PROJECT_FILE.i:444. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:444. + Called from PROJECT_FILE.i:445. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:445. + Called from PROJECT_FILE.i:446. [value] Done for function __gmpz_cmp [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:447. + Called from PROJECT_FILE.i:448. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:448. + Called from PROJECT_FILE.i:449. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:458. + Called from PROJECT_FILE.i:459. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:459. + Called from PROJECT_FILE.i:460. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init <- main. - Called from PROJECT_FILE.i:460. + Called from PROJECT_FILE.i:461. [value] Done for function __gmpz_init [value] computing for function __gmpz_add <- main. - Called from PROJECT_FILE.i:461. + Called from PROJECT_FILE.i:462. [value] Done for function __gmpz_add [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:462. + Called from PROJECT_FILE.i:463. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:463. + Called from PROJECT_FILE.i:464. [value] Done for function __gmpz_cmp -[value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:465. -[value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:466. [value] Done for function __gmpz_clear @@ -421,130 +418,132 @@ PROJECT_FILE.i:406:[value] assigning non deterministic value for the first time [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:468. [value] Done for function __gmpz_clear -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:470. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function __gmpz_clear <- main. + Called from PROJECT_FILE.i:469. +[value] Done for function __gmpz_clear +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:471. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:471. + Called from PROJECT_FILE.i:473. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:472. + Called from PROJECT_FILE.i:474. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:473. + Called from PROJECT_FILE.i:475. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:482. + Called from PROJECT_FILE.i:484. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:483. + Called from PROJECT_FILE.i:485. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:484. + Called from PROJECT_FILE.i:486. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:485. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:487. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:486. + Called from PROJECT_FILE.i:488. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:487. + Called from PROJECT_FILE.i:489. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:493. + Called from PROJECT_FILE.i:495. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:494. + Called from PROJECT_FILE.i:496. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:495. + Called from PROJECT_FILE.i:497. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:496. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:498. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:497. + Called from PROJECT_FILE.i:499. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:498. + Called from PROJECT_FILE.i:500. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:513. + Called from PROJECT_FILE.i:515. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:514. + Called from PROJECT_FILE.i:516. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:515. + Called from PROJECT_FILE.i:517. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:516. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:518. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:517. + Called from PROJECT_FILE.i:519. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:518. + Called from PROJECT_FILE.i:520. [value] Done for function __gmpz_clear [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:522. + Called from PROJECT_FILE.i:524. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_init_set_si <- main. - Called from PROJECT_FILE.i:523. + Called from PROJECT_FILE.i:525. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. - Called from PROJECT_FILE.i:524. + Called from PROJECT_FILE.i:526. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. - Called from PROJECT_FILE.i:525. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:527. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:526. + Called from PROJECT_FILE.i:528. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. - Called from PROJECT_FILE.i:527. + Called from PROJECT_FILE.i:529. [value] Done for function __gmpz_clear [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} x ∈ {7} @@ -586,10 +585,13 @@ extern void __gmpz_add(__mpz_struct * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -610,7 +612,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)1); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(x == 1)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Postcondition", + (char *)"(x == 1)",8); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } @@ -628,11 +631,13 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_5),(long)2); e_acsl_6 = __gmpz_cmp((__mpz_struct const *)(e_acsl_4), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_6 == 0)) { e_acsl_fail((char *)"(x == 2)"); } + e_acsl_assert(! (e_acsl_6 == 0),(char *)"Postcondition", + (char *)"(x == 2)",11); __gmpz_init_set_si((__mpz_struct *)(e_acsl_7),(long)y); e_acsl_8 = __gmpz_cmp((__mpz_struct const *)(e_acsl_7), (__mpz_struct const *)(e_acsl_5)); - if (! (e_acsl_8 == 0)) { e_acsl_fail((char *)"(y == 2)"); } + e_acsl_assert(! (e_acsl_8 == 0),(char *)"Postcondition", + (char *)"(y == 2)",12); __gmpz_clear((__mpz_struct *)(e_acsl_4)); __gmpz_clear((__mpz_struct *)(e_acsl_5)); __gmpz_clear((__mpz_struct *)(e_acsl_7)); @@ -647,7 +652,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_10),(long)2); e_acsl_11 = __gmpz_cmp((__mpz_struct const *)(e_acsl_9), (__mpz_struct const *)(e_acsl_10)); - if (! (e_acsl_11 == 0)) { e_acsl_fail((char *)"(x == 2)"); } + e_acsl_assert(! (e_acsl_11 == 0),(char *)"Precondition", + (char *)"(x == 2)",15); __gmpz_clear((__mpz_struct *)(e_acsl_9)); __gmpz_clear((__mpz_struct *)(e_acsl_10)); x ++; @@ -666,12 +672,14 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_13),(long)3); e_acsl_14 = __gmpz_cmp((__mpz_struct const *)(e_acsl_12), (__mpz_struct const *)(e_acsl_13)); - if (! (e_acsl_14 == 0)) { e_acsl_fail((char *)"(x == 3)"); } + e_acsl_assert(! (e_acsl_14 == 0),(char *)"Precondition", + (char *)"(x == 3)",18); __gmpz_init_set_si((__mpz_struct *)(e_acsl_15),(long)y); __gmpz_init_set_si((__mpz_struct *)(e_acsl_16),(long)2); e_acsl_17 = __gmpz_cmp((__mpz_struct const *)(e_acsl_15), (__mpz_struct const *)(e_acsl_16)); - if (! (e_acsl_17 == 0)) { e_acsl_fail((char *)"(y == 2)"); } + e_acsl_assert(! (e_acsl_17 == 0),(char *)"Precondition", + (char *)"(y == 2)",19); __gmpz_clear((__mpz_struct *)(e_acsl_12)); __gmpz_clear((__mpz_struct *)(e_acsl_13)); __gmpz_clear((__mpz_struct *)(e_acsl_15)); @@ -711,7 +719,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_19),(long)5); e_acsl_20 = __gmpz_cmp((__mpz_struct const *)(e_acsl_18), (__mpz_struct const *)(e_acsl_19)); - if (! (e_acsl_20 == 0)) { e_acsl_fail((char *)"(x == 5)"); } + e_acsl_assert(! (e_acsl_20 == 0),(char *)"Precondition", + (char *)"(x == 5)",23); __gmpz_init_set_si((__mpz_struct *)(e_acsl_21),(long)3); __gmpz_init_set_si((__mpz_struct *)(e_acsl_22),(long)y); __gmpz_init((__mpz_struct *)(e_acsl_23)); @@ -720,11 +729,13 @@ int main(void) (__mpz_struct const *)(e_acsl_22)); e_acsl_24 = __gmpz_cmp((__mpz_struct const *)(e_acsl_18), (__mpz_struct const *)(e_acsl_23)); - if (! (e_acsl_24 == 0)) { e_acsl_fail((char *)"(x == 3+y)"); } + e_acsl_assert(! (e_acsl_24 == 0),(char *)"Precondition", + (char *)"(x == 3+y)",26); __gmpz_init_set_si((__mpz_struct *)(e_acsl_25),(long)2); e_acsl_26 = __gmpz_cmp((__mpz_struct const *)(e_acsl_22), (__mpz_struct const *)(e_acsl_25)); - if (! (e_acsl_26 == 0)) { e_acsl_fail((char *)"(y == 2)"); } + e_acsl_assert(! (e_acsl_26 == 0),(char *)"Precondition", + (char *)"(y == 2)",27); __gmpz_clear((__mpz_struct *)(e_acsl_18)); __gmpz_clear((__mpz_struct *)(e_acsl_19)); __gmpz_clear((__mpz_struct *)(e_acsl_21)); @@ -738,7 +749,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_28),(long)3); e_acsl_29 = __gmpz_cmp((__mpz_struct const *)(e_acsl_27), (__mpz_struct const *)(e_acsl_28)); - if (! (e_acsl_29 == 0)) { e_acsl_fail((char *)"(x == 3)"); } + e_acsl_assert(! (e_acsl_29 == 0),(char *)"Postcondition", + (char *)"(x == 3)",24); __gmpz_init_set_si((__mpz_struct *)(e_acsl_30),(long)y); __gmpz_init_set_si((__mpz_struct *)(e_acsl_31),(long)1); __gmpz_init((__mpz_struct *)(e_acsl_32)); @@ -746,7 +758,8 @@ int main(void) (__mpz_struct const *)(e_acsl_31)); e_acsl_33 = __gmpz_cmp((__mpz_struct const *)(e_acsl_27), (__mpz_struct const *)(e_acsl_32)); - if (! (e_acsl_33 == 0)) { e_acsl_fail((char *)"(x == y+1)"); } + e_acsl_assert(! (e_acsl_33 == 0),(char *)"Postcondition", + (char *)"(x == y+1)",28); __gmpz_clear((__mpz_struct *)(e_acsl_27)); __gmpz_clear((__mpz_struct *)(e_acsl_28)); __gmpz_clear((__mpz_struct *)(e_acsl_30)); @@ -794,7 +807,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_37)); __gmpz_clear((__mpz_struct *)(e_acsl_38)); } - if (! e_acsl_40) { e_acsl_fail((char *)"(x == 1 ==> x == 0)"); } + e_acsl_assert(! e_acsl_40,(char *)"Precondition", + (char *)"(x == 1 ==> x == 0)",33); __gmpz_init_set_si((__mpz_struct *)(e_acsl_41),(long)3); e_acsl_42 = __gmpz_cmp((__mpz_struct const *)(e_acsl_34), (__mpz_struct const *)(e_acsl_41)); @@ -824,8 +838,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_47)); __gmpz_clear((__mpz_struct *)(e_acsl_48)); } - if (! e_acsl_50) { e_acsl_fail((char *)"(x == 3 && y == 2 ==> x == 3)"); - } + e_acsl_assert(! e_acsl_50,(char *)"Precondition", + (char *)"(x == 3 && y == 2 ==> x == 3)",37); e_acsl_51 = __gmpz_cmp((__mpz_struct const *)(e_acsl_34), (__mpz_struct const *)(e_acsl_41)); if (e_acsl_51 == 0) { @@ -863,9 +877,8 @@ int main(void) __gmpz_clear((__mpz_struct *)(e_acsl_58)); __gmpz_clear((__mpz_struct *)(e_acsl_59)); } - if (! e_acsl_61) { - e_acsl_fail((char *)"(x == 3 && y == 2 ==> x+y == 5)"); - } + e_acsl_assert(! e_acsl_61,(char *)"Precondition", + (char *)"(x == 3 && y == 2 ==> x+y == 5)",38); __gmpz_clear((__mpz_struct *)(e_acsl_34)); __gmpz_clear((__mpz_struct *)(e_acsl_35)); __gmpz_clear((__mpz_struct *)(e_acsl_41)); @@ -881,7 +894,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_63),(long)5); e_acsl_64 = __gmpz_cmp((__mpz_struct const *)(e_acsl_62), (__mpz_struct const *)(e_acsl_63)); - if (! (e_acsl_64 == 0)) { e_acsl_fail((char *)"(x == 5)"); } + e_acsl_assert(! (e_acsl_64 == 0),(char *)"Precondition", + (char *)"(x == 5)",41); __gmpz_clear((__mpz_struct *)(e_acsl_62)); __gmpz_clear((__mpz_struct *)(e_acsl_63)); /*@ requires y ≡ 2; */ @@ -893,7 +907,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_66),(long)2); e_acsl_67 = __gmpz_cmp((__mpz_struct const *)(e_acsl_65), (__mpz_struct const *)(e_acsl_66)); - if (! (e_acsl_67 == 0)) { e_acsl_fail((char *)"(y == 2)"); } + e_acsl_assert(! (e_acsl_67 == 0),(char *)"Precondition", + (char *)"(y == 2)",42); __gmpz_clear((__mpz_struct *)(e_acsl_65)); __gmpz_clear((__mpz_struct *)(e_acsl_66)); x += y; @@ -914,7 +929,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_69),(long)7); e_acsl_70 = __gmpz_cmp((__mpz_struct const *)(e_acsl_68), (__mpz_struct const *)(e_acsl_69)); - if (! (e_acsl_70 == 0)) { e_acsl_fail((char *)"(x == 7)"); } + e_acsl_assert(! (e_acsl_70 == 0),(char *)"Precondition", + (char *)"(x == 7)",45); __gmpz_clear((__mpz_struct *)(e_acsl_68)); __gmpz_clear((__mpz_struct *)(e_acsl_69)); __retres = 0; @@ -924,7 +940,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_72),(long)7); e_acsl_73 = __gmpz_cmp((__mpz_struct const *)(e_acsl_71), (__mpz_struct const *)(e_acsl_72)); - if (! (e_acsl_73 == 0)) { e_acsl_fail((char *)"(x == 7)"); } + e_acsl_assert(! (e_acsl_73 == 0),(char *)"Postcondition", + (char *)"(x == 7)",46); __gmpz_clear((__mpz_struct *)(e_acsl_71)); __gmpz_clear((__mpz_struct *)(e_acsl_72)); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/true.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/true.res.oracle index b1b27c539b6661de30d3c66c3e0d5d5210accb6b..b2673c5ef42ad004ca50e0d999b7141cc0edc9bf 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/true.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/true.res.oracle @@ -3,9 +3,14 @@ [value] Initial state computed [value] Values of globals at initialization PROJECT_FILE.i:230:[value] Assertion got status valid. +[value] computing for function e_acsl_assert <- main. + Called from PROJECT_FILE.i:231. +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} x ∈ {0} @@ -16,10 +21,13 @@ PROJECT_FILE.i:230:[value] Assertion got status valid. extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -29,6 +37,7 @@ int main(void) int x; x = 0; /*@ assert \true; */ ; + e_acsl_assert(0,(char *)"Assertion",(char *)"(\\true)",8); __retres = 0; return (__retres); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/typedef.res.oracle b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/typedef.res.oracle index ac463d4ccd1cf3aab4fa7724d3ec3fdb3c2f092a..835e1ce7225399164919727071830b34b0b8477d 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/typedef.res.oracle +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/oracle/typedef.res.oracle @@ -5,31 +5,31 @@ PROJECT_FILE.i:231:[value] Assertion got status valid. [value] computing for function __gmpz_init_set_ui <- main. Called from PROJECT_FILE.i:236. -PROJECT_FILE.i:74:[value] Function __gmpz_init_set_ui: postcondition got status valid. +PROJECT_FILE.i:78:[value] Function __gmpz_init_set_ui: postcondition got status valid. [value] Done for function __gmpz_init_set_ui [value] computing for function __gmpz_init_set_si <- main. Called from PROJECT_FILE.i:237. -PROJECT_FILE.i:78:[value] Function __gmpz_init_set_si: postcondition got status valid. +PROJECT_FILE.i:82:[value] Function __gmpz_init_set_si: postcondition got status valid. [value] Done for function __gmpz_init_set_si [value] computing for function __gmpz_cmp <- main. Called from PROJECT_FILE.i:238. -PROJECT_FILE.i:115:[value] Function __gmpz_cmp: precondition got status valid. -PROJECT_FILE.i:116:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:119:[value] Function __gmpz_cmp: precondition got status valid. +PROJECT_FILE.i:120:[value] Function __gmpz_cmp: precondition got status valid. [value] Done for function __gmpz_cmp -[value] computing for function e_acsl_fail <- main. +[value] computing for function e_acsl_assert <- main. Called from PROJECT_FILE.i:239. -[value] computing for function printf <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. +[value] computing for function printf <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:219. [value] Done for function printf -[value] computing for function exit <- e_acsl_fail <- main. - Called from PROJECT_FILE.i:223. -PROJECT_FILE.i:213:[value] Function exit: postcondition got status invalid. +[value] computing for function exit <- e_acsl_assert <- main. + Called from PROJECT_FILE.i:221. +PROJECT_FILE.i:207:[value] Function exit: postcondition got status invalid. [value] Done for function exit -[value] Recording results for e_acsl_fail -[value] Done for function e_acsl_fail +[value] Recording results for e_acsl_assert +[value] Done for function e_acsl_assert [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:240. -PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. +PROJECT_FILE.i:111:[value] Function __gmpz_clear: precondition got status valid. [value] Done for function __gmpz_clear [value] computing for function __gmpz_clear <- main. Called from PROJECT_FILE.i:241. @@ -37,8 +37,7 @@ PROJECT_FILE.i:107:[value] Function __gmpz_clear: precondition got status valid. [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value] Values at end of function e_acsl_fail: - NON TERMINATING FUNCTION +[value] Values at end of function e_acsl_assert: [value] Values at end of function main: __retres ∈ {0} x ∈ {0} @@ -73,10 +72,13 @@ extern int __gmpz_cmp(__mpz_struct const * /*[1]*/ z1, extern void exit(int status); /*@ assigns \nothing; */ extern int printf(char const * , ...); -void e_acsl_fail(char *msg) +void e_acsl_assert(int predicate, char *kind, char *pred_txt, int line) { - printf("%s\n",msg); - exit(1); + if (predicate) { + printf("%s failed at line %d.\nThe failing predicate is:\n%s.\n",kind, + line,pred_txt); + exit(1); + } return; } @@ -94,7 +96,8 @@ int main(void) __gmpz_init_set_si((__mpz_struct *)(e_acsl_2),(long)0); e_acsl_3 = __gmpz_cmp((__mpz_struct const *)(e_acsl_1), (__mpz_struct const *)(e_acsl_2)); - if (! (e_acsl_3 == 0)) { e_acsl_fail((char *)"(x == 0)"); } + e_acsl_assert(! (e_acsl_3 == 0),(char *)"Assertion",(char *)"(x == 0)", + 10); __gmpz_clear((__mpz_struct *)(e_acsl_1)); __gmpz_clear((__mpz_struct *)(e_acsl_2)); } diff --git a/src/plugins/e-acsl/tests/e-acsl-runtime/quantif.i b/src/plugins/e-acsl/tests/e-acsl-runtime/quantif.i index ccbfd23acaf8a93bc822f5e3a7031f35ef9481e3..65be6f23cf0f1a90e2f3f7e38b17a22d28c70812 100644 --- a/src/plugins/e-acsl/tests/e-acsl-runtime/quantif.i +++ b/src/plugins/e-acsl/tests/e-acsl-runtime/quantif.i @@ -5,8 +5,6 @@ int main(void) { - int a = -1; - // simple universal quantifications /*@ assert \forall integer x; 0 <= x <= 1 ==> x == 0 || x == 1; */ @@ -14,9 +12,19 @@ int main(void) { /*@ assert \forall integer x; 0 < x < 1 ==> \false; */ /*@ assert \forall integer x; 0 <= x < 1 ==> x == 0; */ - // multiple universal quantifications + /* // multiple universal quantifications */ + /*@ assert \forall integer x,y,z; 0 <= x < 2 && 0 <= y < 5 && 0 <= z <= y - ==> x+z <= y+1; */ - + ==> x+z <= y+1; */ + + // simple existential quantification + + /*@ assert \exists int x; 0 <= x < 10 && x == 5; */ + + // mixed universal and existential quantifications + + /*@ assert \forall int x; 0 <= x < 10 + ==> x % 2 == 0 ==> \exists integer y; 0 <= y <= x/2 && x == 2 * y; */ + return 0; } diff --git a/src/plugins/e-acsl/typing.ml b/src/plugins/e-acsl/typing.ml index 7c0625fce18772bcecb0cad3d43e19d67858504e..184c183d6af469c2a1945fa51a5ca88894e46ddb 100644 --- a/src/plugins/e-acsl/typing.ml +++ b/src/plugins/e-acsl/typing.ml @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/e-acsl/typing.mli b/src/plugins/e-acsl/typing.mli index b115f54ef9013a3778b8983666a9ca2d9442adc0..fa5269c9293f073709413a7ddfa45b386c4b5aaf 100644 --- a/src/plugins/e-acsl/typing.mli +++ b/src/plugins/e-acsl/typing.mli @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/e-acsl/visit.ml b/src/plugins/e-acsl/visit.ml index b1418f57e1f185e4cbb3e158448f6c3b884a904f..59b78bb42fa31769b9a5a77f67420560b066c7c4 100644 --- a/src/plugins/e-acsl/visit.ml +++ b/src/plugins/e-acsl/visit.ml @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -59,6 +59,25 @@ let constant_to_exp ?(loc=Location.unknown) = function | CStr _ | CWStr _ | CChr _ | CReal _ | CEnum _ as c -> new_exp ?loc (Const c), false +let conditional_to_exp loc ctx e1 (e2, env2) (e3, env3) = + let env = Env.pop (Env.pop env3) in + Env.new_var + env + None + (match ctx with Linteger -> Mpz.t | Ctype ty -> ty | _ -> assert false) + (fun v _ -> + let lv = var v in + let affect e = mkStmt ~valid_sid:true (Instr (Set(lv, e, loc))) in + let then_block, _ = + let s = affect e2 in + Env.pop_and_get env2 s ~global_clear:false Env.Middle + in + let else_block, _ = + let s = affect e3 in + Env.pop_and_get env3 s ~global_clear:false Env.Middle + in + [ mkStmt ~valid_sid:true (If(e1, then_block, else_block, loc)) ]) + let rec thost_to_host env = function | TVar { lv_origin = Some v } -> Var v, env | TVar ({ lv_origin = None } as logic_v) -> @@ -165,7 +184,10 @@ and context_insensitive_term_to_exp env t = let mk_stmts v e = let name = name_of_mpz_arith_bop bop in let cond = - Misc.mk_e_acsl_guard guard (Logic_const.prel (Req, t2, zero)) + Misc.mk_e_acsl_guard + (Env.annotation_kind env) + guard + (Logic_const.prel ~loc (Req, t2, zero)) in Env.add_assert env cond (Logic_const.prel (Rneq, t2, zero)); let instr = match ctx with @@ -191,9 +213,25 @@ and context_insensitive_term_to_exp env t = | TBinOp((Shiftlt | Shiftrt), _, _) -> (* left/right shift *) Error.not_yet "left/right shift" - | TBinOp((LOr | LAnd | BOr | BXor | BAnd), _, _) -> + | TBinOp(LOr, t1, t2) -> + (* t1 || t2 <==> if t1 then true else t2 *) + let ty = Typing.principal_type_from_term t1 t2 in + let e1, env1 = term_to_exp env ty t1 in + let env' = Env.push env1 in + let res2 = term_to_exp (Env.push env') ty t2 in + let e, env = conditional_to_exp loc ty e1 (one loc, env') res2 in + e, env, false + | TBinOp(LAnd, t1, t2) -> + (* t1 && t2 <==> if t1 then t2 else false *) + let ty = Typing.principal_type_from_term t1 t2 in + let e1, env1 = term_to_exp env ty t1 in + let _, env2 as res2 = term_to_exp (Env.push env1) ty t2 in + let env3 = Env.push env2 in + let e, env = conditional_to_exp loc ty e1 res2 (zero loc, env3) in + e, env, false + | TBinOp((BOr | BXor | BAnd), _, _) -> (* other logic/arith operators *) - Error.not_yet "missing binary operator" + Error.not_yet "missing binary bitwise operator" | TBinOp(PlusPI | IndexPI | MinusPI | MinusPP as bop, t1, t2) -> (* binary operation over pointers *) (* [TODO] untested *) @@ -223,55 +261,17 @@ and context_insensitive_term_to_exp env t = | Tapp _ -> Error.not_yet "applying logic function" | Tlambda _ -> Error.not_yet "functional" | TDataCons _ -> Error.not_yet "constructor" - | Tif _ -> Error.not_yet "conditional" + | Tif(t1, t2, t3) -> + let e1, env1 = term_to_exp env (Ctype intType) t1 in + let ty = Typing.principal_type_from_term t2 t3 in + let (_, env2 as res2) = term_to_exp (Env.push env1) ty t2 in + let res3 = term_to_exp (Env.push env2) ty t3 in + let e, env = conditional_to_exp loc ty e1 res2 res3 in + e, env, false | Tat(t', label) -> - let stmt = Env.stmt_of_label env label in - let ty = t'.term_type in (* convert [t'] to [e] in a separated local env *) - let e, env = term_to_exp (Env.push env) ty t' in - let new_v = ref None in - (* generate a new variable denoting [\at(t',label)]. - That is this variable which is the resulting expression. - ACSL typing rule ensures that the type of this variable is the same as - the one of [e]. *) - let res, new_env = - Env.new_var ~global:true env - (Some t) (typeOf e) - (fun lv' e' -> - (* store the corresponding left value and expression corresponding to - the new variable. Will be used in the visitor in order to - initialize it. *) - new_v := Some (lv', e'); []) - in - let env_ref = ref new_env in - (* visitor modifying in place the labeled statement in order to store [e] - in the resulting variable at this location which is the only correct - one. *) - let o = object - inherit Visitor.frama_c_inplace - method vstmt_aux stmt = - let new_lv, new_e = Extlib.the !new_v in - (* either a standard C affectation or an mpz one according to type of - [e] *) - let new_stmt = Mpz.init_set (var new_lv) new_e e in - assert (!env_ref == new_env); - (* generate the new block of code for the labeled statement and the - corresponding environment *) - let block, new_env = - Env.pop_and_get new_env new_stmt ~global_clear:false Env.Middle - in - let pre = match label with - | LogicLabel(_, s) when s = "Here" || s = "Post" -> true - | StmtLabel _ | LogicLabel _ -> false - in - env_ref := Env.extend_stmt_in_place new_env stmt ~pre block; - ChangeTo stmt - end - in - let bhv = (Env.get_visitor new_env)#behavior in - let new_stmt = Visitor.visitFramacStmt o (get_stmt bhv stmt) in - set_stmt bhv stmt new_stmt; - res, !env_ref, false + let e, env = term_to_exp (Env.push env) t'.term_type t' in + at_to_exp env (Some t) label e | Tbase_addr _ -> Error.not_yet "\\base_addr" | Tblock_length _ -> Error.not_yet "\\block_length" | Tnull -> mkCast (zero ~loc) (TPtr(TVoid [], [])), env, false @@ -324,6 +324,54 @@ and comparison_to_exp ?(loc=Location.unknown) ?e1 env bop t1 t2 t_opt = | _ -> new_exp ?loc (BinOp(bop, e1, e2, intType)), env +and at_to_exp env t_opt label e = + let stmt = Env.stmt_of_label env label in + let new_v = ref None in + (* generate a new variable denoting [\at(t',label)]. + That is this variable which is the resulting expression. + ACSL typing rule ensures that the type of this variable is the same as + the one of [e]. *) + let res, new_env = + Env.new_var ~global:true env + t_opt + (typeOf e) + (fun lv' e' -> + (* store the corresponding left value and expression corresponding to + the new variable. Will be used in the visitor in order to + initialize it. *) + new_v := Some (lv', e'); + []) + in + let env_ref = ref new_env in + (* visitor modifying in place the labeled statement in order to store [e] + in the resulting variable at this location which is the only correct + one. *) + let o = object + inherit Visitor.frama_c_inplace + method vstmt_aux stmt = + let new_lv, new_e = Extlib.the !new_v in + (* either a standard C affectation or an mpz one according to type of + [e] *) + let new_stmt = Mpz.init_set (var new_lv) new_e e in + assert (!env_ref == new_env); + (* generate the new block of code for the labeled statement and the + corresponding environment *) + let block, new_env = + Env.pop_and_get new_env new_stmt ~global_clear:false Env.Middle + in + let pre = match label with + | LogicLabel(_, s) when s = "Here" || s = "Post" -> true + | StmtLabel _ | LogicLabel _ -> false + in + env_ref := Env.extend_stmt_in_place new_env stmt ~pre block; + ChangeTo stmt + end + in + let bhv = (Env.get_visitor new_env)#behavior in + let new_stmt = Visitor.visitFramacStmt o (get_stmt bhv stmt) in + set_stmt bhv stmt new_stmt; + res, !env_ref, false + (* Convert an ACSL named predicate into a corresponding C expression (if any) in the given environment. Also extend this environment which includes the generating constructs. *) @@ -342,64 +390,44 @@ let rec named_predicate_to_exp env p = | Pand(p1, p2) -> (* p1 && p2 <==> if p1 then p2 else false *) let e1, env1 = named_predicate_to_exp env p1 in - let e2, env2 = named_predicate_to_exp (Env.push env1) p2 in - let env = Env.pop env2 in - Env.new_var - env - None - intType - (fun v _ -> - let lv = var v in - let then_block, _ = - let s = mkStmtOneInstr ~valid_sid:true (Set(lv, e2, loc)) in - Env.pop_and_get env2 s ~global_clear:false Env.Middle - in - let else_block = - mkBlock [ mkStmtOneInstr ~valid_sid:true (Set(lv, zero loc, loc)) ] - in - [ mkStmt ~valid_sid:true (If(e1, then_block, else_block, loc)) ]) + let _, env2 as res2 = named_predicate_to_exp (Env.push env1) p2 in + let env3 = Env.push env2 in + conditional_to_exp loc (Ctype intType) e1 res2 (zero loc, env3) | Por(p1, p2) -> (* p1 || p2 <==> if p1 then true else p2 *) let e1, env1 = named_predicate_to_exp env p1 in - let e2, env2 = named_predicate_to_exp (Env.push env1) p2 in - let env = Env.pop env2 in - Env.new_var - env - None - intType - (fun v _ -> - let lv = var v in - let then_block = - mkBlock [ mkStmt ~valid_sid:true (Instr (Set(lv, one loc, loc))) ] - in - let else_block, _ = - let s = mkStmt ~valid_sid:true (Instr (Set(lv, e2, loc))) in - Env.pop_and_get env2 s ~global_clear:false Env.Middle - in - [ mkStmt ~valid_sid:true (If(e1, then_block, else_block, loc)) ]) + let env' = Env.push env1 in + let res2 = named_predicate_to_exp (Env.push env') p2 in + conditional_to_exp loc (Ctype intType) e1 (one loc, env') res2 | Pxor _ -> Error.not_yet "xor" | Pimplies(p1, p2) -> - named_predicate_to_exp env (Logic_const.por ((Logic_const.pnot p1), p2)) - | Piff _ -> Error.not_yet "<==>" + (* (p1 ==> p2) <==> !p1 || p2 *) + named_predicate_to_exp + env + (Logic_const.por ~loc ((Logic_const.pnot ~loc p1), p2)) + | Piff(p1, p2) -> + (* (p1 <==> p2) <==> (p1 ==> p2 && p2 ==> p1) *) + named_predicate_to_exp + env + (Logic_const.pand ~loc + (Logic_const.pimplies ~loc (p1, p2), + Logic_const.pimplies ~loc (p2, p1))) | Pnot p -> let e, env = named_predicate_to_exp env p in new_exp ~loc (UnOp(LNot, e, TInt(IInt, []))), env - | Pif _ -> Error.not_yet "_ ? _ : _" + | Pif(t, p2, p3) -> + let e1, env1 = term_to_exp env (Ctype intType) t in + let (_, env2 as res2) = named_predicate_to_exp (Env.push env1) p2 in + let res3 = named_predicate_to_exp (Env.push env2) p3 in + conditional_to_exp loc (Ctype intType) e1 res2 res3 | Plet _ -> Error.not_yet "let _ = _ in _" - | Pforall(bounded_vars, { content = Pimplies(hyps, goal) }) -> - Quantif.convert env loc p bounded_vars hyps goal - | Pforall _ -> Error.not_yet "unguarded \\forall quantification" - (* | Pexists(bounded_vars, { content = Pand(hyps, _goal) }) -> - let guards = compute_quantif_guards p bounded_vars hyps in - List.iter - (fun (t1, _, x, _, t2) -> - Options.feedback - "getting %a OP %a OP %a" - d_term t1 d_logic_var x d_term t2) - guards; - assert false*) - | Pexists _ -> Error.not_yet "unguarded \\exists quantification" - | Pat _ -> Error.not_yet "\\at" + | Pforall _ | Pexists _ -> Quantif.quantif_to_exp env p + | Pat(p, label) -> + (* convert [t'] to [e] in a separated local env *) + let e, env = named_predicate_to_exp (Env.push env) p in + let e, env, is_string = at_to_exp env None label e in + assert (not is_string); + e, env | Pvalid _ -> Error.not_yet "\\valid" | Pvalid_index _ -> Error.not_yet "\\valid_index" | Pvalid_range _ -> Error.not_yet "\\valid_range" @@ -416,29 +444,38 @@ let () = statement (if any) for runtime assertion checking *) (* ************************************************************************** *) +let assumes_predicate bhv = + List.fold_left + (fun acc p -> Logic_const.pand (acc, Logic_const.unamed p.ip_content)) + Logic_const.ptrue + bhv.b_assumes + let convert_preconditions env behaviors = + let env = Env.set_annotation_kind env Misc.Precondition in let do_behavior env b = - let assumes_pred = - List.fold_left - (fun acc p -> Logic_const.pand (acc, Logic_const.unamed p.ip_content)) - Logic_const.ptrue - b.b_assumes - in + let assumes_pred = assumes_predicate b in List.fold_left (fun env p -> + let loc = p.ip_loc in let p = - Logic_const.pimplies (assumes_pred, Logic_const.unamed p.ip_content) + Logic_const.pimplies + ~loc + (assumes_pred, Logic_const.unamed ~loc p.ip_content) in let e, env = named_predicate_to_exp env p in - Env.add_stmt env (Misc.mk_e_acsl_guard ~reverse:true e p)) + Env.add_stmt + env + (Misc.mk_e_acsl_guard ~reverse:true (Env.annotation_kind env) e p)) env b.b_requires in List.fold_left do_behavior env behaviors let convert_postconditions env behaviors = + let env = Env.set_annotation_kind env Misc.Postcondition in (* generate one guard by postcondition of each behavior *) let do_behavior env b = + let assumes_pred = assumes_predicate b in List.fold_left (fun env (t, p) -> if b.b_assigns <> WritesAny then @@ -446,15 +483,20 @@ let convert_postconditions env behaviors = if b.b_extended <> [] then Error.not_yet "grammar extensions in behavior"; match t with - | Normal -> - let p = p.ip_content in - if p <> Ptrue && b.b_assumes <> [] then - Error.not_yet "assumes in conjunction with ensures in behaviors"; - let p = Logic_const.unamed p in - let e, env = named_predicate_to_exp env p in - Env.add_stmt env (Misc.mk_e_acsl_guard ~reverse:true e p) - | Exits | Breaks | Continues | Returns -> - Error.not_yet "@[abnormal termination case in behavior@]") + | Normal -> + let loc = p.ip_loc in + let p = p.ip_content in + let p = + Logic_const.pimplies + ~loc + (Logic_const.pold ~loc assumes_pred, Logic_const.unamed ~loc p) + in + let e, env = named_predicate_to_exp env p in + Env.add_stmt + env + (Misc.mk_e_acsl_guard ~reverse:true (Env.annotation_kind env) e p) + | Exits | Breaks | Continues | Returns -> + Error.not_yet "@[abnormal termination case in behavior@]") env b.b_post_cond in @@ -465,9 +507,9 @@ let convert_pre_spec env spec = if spec.spec_variant <> None then Error.not_yet "variant clause"; if spec.spec_terminates <> None then Error.not_yet "terminates clause"; if spec.spec_complete_behaviors <> [] then - Error.not_yet "complete behaviors"; + Error.not_yet "complete behavior"; if spec.spec_disjoint_behaviors <> [] then - Error.not_yet "disjoint behaviors"; + Error.not_yet "disjoint behavior"; convert_preconditions env spec.spec_behavior in Error.handle convert env @@ -478,11 +520,20 @@ let convert_post_spec env spec = let convert_named_predicate env p = let e, env = named_predicate_to_exp env p in assert (Typ.equal (typeOf e) intType); - Env.add_stmt env (Misc.mk_e_acsl_guard ~reverse:true e p) + Env.add_stmt + env + (Misc.mk_e_acsl_guard ~reverse:true (Env.annotation_kind env) e p) let convert_pre_code_annotation env annot = let convert env = match annot.annot_content with - | AAssert(l, p) -> + | AAssert(l, p) | AInvariant(l, false (* invariant as assertion *), p) + as a -> + let kind = match a with + | AAssert _ -> Misc.Assertion + | AInvariant _ -> Misc.Invariant + | _ -> assert false + in + let env = Env.set_annotation_kind env kind in if l <> [] then Error.not_yet "@[assertions applied only on some behaviors@]"; convert_named_predicate env p @@ -490,7 +541,7 @@ let convert_pre_code_annotation env annot = if l <> [] then Error.not_yet "@[statement contract applied only on some behaviors@]"; convert_pre_spec env spec ; - | AInvariant _ -> Error.not_yet "invariant" + | AInvariant(_, b, _) -> assert b; Error.not_yet "loop invariant" | AVariant _ -> Error.not_yet "variant" | AAssigns _ -> Error.not_yet "assigns" | APragma _ -> Error.not_yet "pragma" @@ -512,7 +563,7 @@ let convert_post_code_annotation env annot = (* Visitor *) (* ************************************************************************** *) -(* local reference to the below visitor and to [do_visit] *) +(* local references to the below visitor and to [do_visit] *) let first_global = ref true let function_env = ref Env.dummy let funspec = ref (Cil.empty_funspec ()) @@ -540,7 +591,6 @@ class e_acsl_visitor prj generate = object (self) (* method vinit v off i = assert false *) method vvdec vi = - (* TODO: handle functions without code *) try let old_vi = get_original_varinfo self#behavior vi in let old_kf = Globals.Functions.get old_vi in @@ -551,6 +601,7 @@ class e_acsl_visitor prj generate = object (self) DoChildren with Not_found -> (* function without code *) + (* TODO: do better *) DoChildren method vfunc f = diff --git a/src/plugins/e-acsl/visit.mli b/src/plugins/e-acsl/visit.mli index 273d0304f099f9e8cfb1778c019ca8769d5daecd..ea0a037c3bd12c51d90f31f05fd1fede5a3c600f 100644 --- a/src/plugins/e-acsl/visit.mli +++ b/src/plugins/e-acsl/visit.mli @@ -1,8 +1,8 @@ (**************************************************************************) (* *) -(* This file is part of the E-ACSL plug-in of Frama-C. *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) (* *) -(* Copyright (C) 2011 *) +(* Copyright (C) 2012 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *)