Questions tagged [frama-c]

Frama-C is an Open Source suite of tools dedicated to the analysis of C source code.

Frama-C offers ready-to-use analyses for C programs: call graph, value analysis, functional dependencies, Program Dependence Graph, runtime monitoring, etc. It also allows the verification of functional properties, temporal logic, and much more. Results can be expressed in plain text, in SARIF, or in Frama-C's graphical interface.

Each analysis is implemented as a plug-in, and plug-ins inside the platform can use the results of one another. Frama-C is Open Source and extensible: new analyses can be implemented in OCaml as additional plug-ins that take advantage of existing ones. They communicate using the ACSL specification language, which also enables describing what the program is supposed to do.

Most provided analyses in Frama-C are sound: used within a delimited perimeter, all the behaviors that can happen at run-time are included in the behaviors statically predicted by Frama-C. Notwithstanding the possibility of bugs, plug-ins must be used as documented for the property to hold. This makes it possible to use Frama-C for the formal verification of C programs.

447 questions
2
votes
0 answers

Analyze precompiled C++ files with Frama-C

I'm trying to analyze some pre-compiled C++ files (.ii) using Frama-C. I know it has many limitations, but my problem has to do with compilation errors which I think are related to the clang compiler. I'm using Frama-21.0 and clang-0.0.9. I'm using…
José Luis
  • 21
  • 2
2
votes
1 answer

Eva method to compute intervals [frama-c]

My goal is to understand how Eva shrinks the intervals for a variable. for example: unsigned int nondet_uint(void); int main() { unsigned int x=nondet_uint(); unsigned int y=nondet_uint(); //@ assert x >= 20 && x <= 30; //@ assert y <= 60; …
2
votes
1 answer

Frama-C's GUI (frama-c-gui) not installed despite installing frama-c on WSL Ubuntu

I followed the instructions on http://frama-c.com/install-21.1-Scandium.html#installing-frama-c-on-windows-via-wsl completely to install Frama-C (21.1) using opam. I want to use the GUI for Frama-C but when I tried executing the command frama-c-gui,…
Wayne Cho
  • 21
  • 2
2
votes
1 answer

How to give the right precondition to prove an assert statemnt in frama-c?

I have been working on some basic programs in c to verify using the frama-c tool.I wanted to know why the assertion is not being proved in the program.Thanks in advance. #include /*@requires \valid(a) && \valid(b) && \separated(a,b); …
Niresh
  • 67
  • 7
2
votes
1 answer

How do I write an "is power of 2" predicate in ACSL?

My attempt to write an ACSL predicate to see if an integer is a power of 2 goes like this: /*@ predicate positive_power_of_2 (integer i) = i > 0 && (i == 1 || ((i & 1) == 0 && positive_power_of_2 (i >> 1))); */ However when I added some…
Rich
  • 926
  • 1
  • 9
  • 17
2
votes
1 answer

Can't find some flags in frama-c.21.1

I want to use frama-c as an analyzer to check if a C source code have undefined behavior. I find the code provide by C-Reduce at here. However, some of flags in this script I can not find it in the new version of frama-c. The flags I can not find…
Suo
  • 89
  • 5
2
votes
1 answer

ACSL list example in the documentation generate a bad sounding warning

I tried the list example (Example 2.23 on page 37, in Section "Function Contracts") from the ACSL manual, but I hid the implementation of incr_list and changed the return type. Full source below. struct list { int hd; struct list *next; }; /*@…
2
votes
1 answer

frama-c slicing plugin appears to discard used stack values

Problem description I'm developing a frama-c plugin that uses the slicing plugin as a library to remove unused bits of automatically generated code. Unfortunately the slicing plugin drops a bunch of stack values, which are actually used. They are…
2
votes
1 answer

Verifying matrix transpose function in FRAMA-C

I have a simple matrix transpose function which I would like to verify with a postcondition such that matrix_transpose(matrix_transpose(original_matrix)==original_matrix What would be the syntax for that? I've tried ensures…
2
votes
1 answer

frama-c / ACSL / WP : Cardinality of a set

I often use cardinality of sets in others formal specifications and I wondering if it was possible to use it in ACSL with WP frama-c plugin. For example, it seems clearer to me to write assumes card({*a, *b, *c}) == 3 rather than assumes *a != *b…
no_name
  • 295
  • 1
  • 2
  • 14
2
votes
1 answer

How to save types of variables to a file using Frama-C

I am trying to print types of variables in C program using Frama-C. I found that this information is represented in the GUI as in the figure below. However, I cannot found a way to output this information to a file. Could you please suggest me the…
Thuy Nguyen
  • 353
  • 2
  • 10
2
votes
1 answer

Why Frama-C v20.0 Calcium does not support redefinition of a typedef in a non-global scope

I am trying to analyze the following C program: #include typedef struct a { int x; char y; } alias; int main() { typedef struct b { int x; int y; } alias; alias *var = (unsigned long*) 0x12345678; …
Thuy Nguyen
  • 353
  • 2
  • 10
2
votes
1 answer

Sparecode analysis in Frama-C

Sorry if this is detailed somewhere, I tried searching in the different documentations of Frama-C without luck. I'm trying to do dead code elimination in my code, but I don't understand the results of the tool. Is there any paper / documentation…
2
votes
1 answer

Dynamic array with Frama-C and Eva

In https://stackoverflow.com/a/57116260/946226 I learned how to verify that a function foo that operates on a buffer (given by a begin and end pointer) really only reads form it, but creating a representative main function that calls it: #include…
2
votes
1 answer

How could I filter .csv generated by "report" plug-in in Frama-C?

Currently I'm executing: frama-c -wp -wp-rte -report-rules test_rules.json -wp-split -wp-fct max -wp-status-maybe -wp-status-invalid -wp-timeout 10 -wp-prover alt-ergo -wp-par 12 -warn-signed-overflow -warn-unsigned-overflow -warn-special-float…
The_Ghost
  • 2,070
  • 15
  • 26