Precondition Inference from Intermittent Assertions and Application to Contracts on Collections - Archive ouverte HAL Accéder directement au contenu
Communication Dans Un Congrès Année : 2011

Precondition Inference from Intermittent Assertions and Application to Contracts on Collections

Résumé

In the context of program design by contracts, programmers often insert assertions in their code to be optionally checked at runtime, at least during the debugging phase. These assertions would better be given as a precondition of the method/procedure in which they appear. Potential errors would be discovered earlier and, more importantly, the precondition could be used in the context of separate static program analysis as part of the abstract semantics of the code. However in the case of collections (data structures such as arrays, lists, etc) checking both the precondition and the assertions at runtime appears superfluous and costly. So the precondition is often omitted since it is checked anyway at runtime by the assertions. It follows that the static analysis can be much less precise, a fact that can be difficult to understand since ''the precondition and assertions are equivalent'' (i.e. at runtime, up to the time at which warnings are produced, but not statically) e.g. for separate static analysis. We define precisely and formally the contract inference problem from intermittent assertions on scalar variables and elements of collections inserted in the code by the programmer. Our definition excludes no good run even when a non-deterministic choice (e.g. an interactive input) could lead to a bad one. We then introduce new abstract interpretation-based methods to automatically infer both the static contract precondition of a method/procedure and the code to check it at runtime on scalar and collection variables.
Fichier principal
Vignette du fichier
main.pdf (309.95 Ko) Télécharger le fichier
Origine : Fichiers produits par l'(les) auteur(s)
Loading...

Dates et versions

inria-00543881 , version 1 (06-12-2010)

Identifiants

  • HAL Id : inria-00543881 , version 1

Citer

Patrick Cousot, Radhia Cousot, Logozzo Francesco. Precondition Inference from Intermittent Assertions and Application to Contracts on Collections. Proceedings of the 12th Conference on Verification, Model Checking and Abstract Interpretation (VMCAI'11), Jan 2011, Austin, Texas, United States. ⟨inria-00543881⟩
214 Consultations
349 Téléchargements

Partager

Gmail Facebook X LinkedIn More