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


  • Subject: [Frama-c-discuss] Value Analysis and the modulo operator
  • From: arenis at informatik.uni-freiburg.de (Sergio Feo)
  • Date: Thu, 26 Jul 2012 14:41:19 +0200

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/7a712fcf/attachment.html>