Frama-C-discuss mailing list archives

This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] Value Analysis and the modulo operator



Replacing the current assert by the following :
                    //@ assert (y == 27 && b==1) ==> ((x % 2 == 0));
it is validated by Value Analysis, thanks to the slevel>0.
Maybe the explanation is that the relation between y==27 and b==1 is not stored by the analyzer after the if/else instr and the call to f in the main function, but only the intervals are kept (the domain of VA is interval abstract domain).

Let?s Value?s experts confirm or not the explanation.

Best,
D.

De : frama-c-discuss-bounces at lists.gforge.inria.fr [mailto:frama-c-discuss-bounces at lists.gforge.inria.fr] De la part de Sergio Feo
Envoy? : jeudi 26 juillet 2012 14:41
? : frama-c-discuss at lists.gforge.inria.fr
Objet : [Frama-c-discuss] Value Analysis and the modulo operator

Dear all,

We stumbled upon the following issue today: We have a little toy program (see code below) that uses the modulo operator in an assertion. By looking at the state dumps generated by Frama_C_dump_each(), value analysis should be able to assign the value "valid" to our assertion. Instead, the value unknown is assigned. The question is: To what extent can Value Analysis reason about the modulo operator? What should one be aware of when using it in ACSL annotations?

Thank you very much in advance,

Sergio A. Feo-Arenis

The program:
------------------------------------------------------------------------------
#include "builtin.h"

int x;

void f(int b, int a)
{
    if (b) x = 2*a;
    else x = 2*a+1;
}

int main()
{
    int y;
    int b = 0;

    y = Frama_C_interval(0,100);

    if (y == 27)
        b = 1;
    else
        b = 0;

    f(b, y);
    Frama_C_dump_each();
    //@ assert (y == 27) ==> ((x % 2 == 0));
    return 0;
}
------------------------------------------------------------------------------
We called frama-c with the following parameters:
frama-c-gui test.c /usr/share/frama-c/builtin.c -val -slevel 10
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/frama-c-discuss/attachments/20120726/8d495d1a/attachment-0001.html>