package frama-c
Install
Dune Dependency
Authors
-
MMichele Alberti
-
TThibaud Antignac
-
GGergö Barany
-
PPatrick Baudin
-
NNicolas Bellec
-
TThibaut Benjamin
-
AAllan Blanchard
-
LLionel Blatter
-
FFrançois Bobot
-
RRichard Bonichon
-
VVincent Botbol
-
QQuentin Bouillaguet
-
DDavid Bühler
-
ZZakaria Chihani
-
LLoïc Correnson
-
JJulien Crétin
-
PPascal Cuoq
-
ZZaynah Dargaye
-
BBasile Desloges
-
JJean-Christophe Filliâtre
-
PPhilippe Herrmann
-
MMaxime Jacquemin
-
FFlorent Kirchner
-
AAlexander Kogtenkov
-
RRemi Lazarini
-
TTristan Le Gall
-
JJean-Christophe Léchenet
-
MMatthieu Lemerre
-
DDara Ly
-
DDavid Maison
-
CClaude Marché
-
AAndré Maroneze
-
TThibault Martin
-
FFonenantsoa Maurica
-
MMelody Méaulle
-
BBenjamin Monate
-
YYannick Moy
-
PPierre Nigron
-
AAnne Pacalet
-
VValentin Perrelle
-
GGuillaume Petiot
-
DDario Pinto
-
VVirgile Prevosto
-
AArmand Puccetti
-
FFélix Ridoux
-
VVirgile Robles
-
JJan Rochel
-
MMuriel Roger
-
JJulien Signoles
-
NNicolas Stouls
-
KKostyantyn Vorobyov
-
BBoris Yakobowski
Maintainers
Sources
sha256=d2fbb3b8d0ff83945872e9e6fa258e934a706360e698dae3b4d5f971addf7493
doc/frama-c-e-acsl.core/E_ACSL/Typing/index.html
Module E_ACSL.Typing
Type system which computes the smallest C type that may contain all the possible values of a given integer term or predicate. Also compute the required casts. It is based on interval inference of module Interval
.
It implement Figure 4 of J. Signoles' JFLA'15 paper "Rester statique pour devenir plus rapide, plus précis et plus mince".
Example: consider a variable x
of type int
and a variable y
of type char on a (strange) architecture in which values of type int
belongs to the interval [-128;127]
and values of type char
belongs to the interval [-32;31]
, while there are no other integral types. Then here are some information computed from the term 1+(x+1)/(y-64)
by the type system: 1. x+1
must be a GMP (because of the potential overflow) 2. consequently x
, which is an int
, must be coerced into a GMP and the same for the number 1 in this addition. 3. y-64
can be computed in an int
(because the result belongs to the interval [-96;-33]
). 4. (x+1)/(y-64)
must be a GMP operation because the numerator is a GMP (see 1.). Consequently y-64
must be coerced into a GMP too. However, the result belongs to the interval [-3;3]
and thus can be safely coerced to an int
. 5. Consequently the addition of the toplevel term 1+(x+1)/(y-64)
can safely be computed in int
: its result belongs to [-2;4]
.
Datatypes
Smart constructors
val c_int : Analyses_types.number_ty
val ikind : Frama_c_kernel.Cil_types.ikind -> Analyses_types.number_ty
val fkind : Frama_c_kernel.Cil_types.fkind -> Analyses_types.number_ty
val gmpz : Analyses_types.number_ty
val rational : Analyses_types.number_ty
val nan : Analyses_types.number_ty
Useful operations over number_ty
val typ_of_number_ty : Analyses_types.number_ty -> Frama_c_kernel.Cil_types.typ
val number_ty_of_typ :
post:bool ->
Frama_c_kernel.Cil_types.typ ->
Analyses_types.number_ty
Reverse of typ_of_number_ty
number_ty_of_typ ~post ty
return the number_ty
corresponding to a C type. post
indicates if the type is before or after the typing phase. The GMP types will be recognized only in a post-typing phase.
val join :
Analyses_types.number_ty ->
Analyses_types.number_ty ->
Analyses_types.number_ty
number_ty
is a join-semi-lattice if you do not consider Other
. If there is no Other
in argument, this function computes the join of this semi-lattice. If one of the argument is Other
, the function assumes that the other argument is also Other
. In this case, the result is Other
.
val number_ty_bound_variable :
profile:Analyses_datatype.Profile.t ->
(Frama_c_kernel.Cil_types.term
* Frama_c_kernel.Cil_types.logic_var
* Frama_c_kernel.Cil_types.term) ->
Analyses_types.number_ty
return the type of a quantified logic variable
Getters
Below, the functions assume that either type_term
or type_named_predicate
has been previously computed for the given term or predicate.
val get_number_ty :
logic_env:Analyses_datatype.Logic_env.t ->
Frama_c_kernel.Cil_types.term ->
Analyses_types.number_ty
val get_effective_ty :
logic_env:Analyses_datatype.Logic_env.t ->
Frama_c_kernel.Cil_types.term ->
Analyses_types.number_ty
val get_typ :
logic_env:Analyses_datatype.Logic_env.t ->
Frama_c_kernel.Cil_types.term ->
Frama_c_kernel.Cil_types.typ
Get the type which the given term must be generated to.
val get_effective_typ :
logic_env:Analyses_datatype.Logic_env.t ->
Frama_c_kernel.Cil_types.term ->
Frama_c_kernel.Cil_types.typ
Get the type which the given term must be converted to if any, and the translation type otherwise
val get_cast :
logic_env:Analyses_datatype.Logic_env.t ->
Frama_c_kernel.Cil_types.term ->
Frama_c_kernel.Cil_types.typ option
Get the type which the given term must be converted to (if any).
val unsafe_set :
Frama_c_kernel.Cil_types.term ->
?ctx:Analyses_types.number_ty ->
logic_env:Analyses_datatype.Logic_env.t ->
Analyses_types.number_ty ->
unit
Register that the given term has the given type in the given context (if any). No verification is done.
Typing/types-related utils
val typ_of_lty :
Frama_c_kernel.Cil_types.logic_type ->
Frama_c_kernel.Cil_types.typ
Typing processing
val type_program : Frama_c_kernel.Cil_types.file -> unit
compute and store the type of all the terms that will be translated in a program
val preprocess_predicate :
logic_env:Analyses_datatype.Logic_env.t ->
Frama_c_kernel.Cil_types.predicate ->
unit
compute and store the types of all the terms in a given predicate
val preprocess_rte :
logic_env:Analyses_datatype.Logic_env.t ->
Frama_c_kernel.Cil_types.code_annotation ->
unit
compute and store the type of all the terms in a code annotation
val preprocess_term :
use_gmp_opt:bool ->
?ctx:Analyses_types.number_ty ->
logic_env:Analyses_datatype.Logic_env.t ->
Frama_c_kernel.Cil_types.term ->
unit
Compute the type of each subterm of the given term in the given context. If use_gmp_opt
is false, then the conversion to the given context is done even if -e-acsl-gmp-only is set.