Frama-C / Frama-C-snapshot

Release snapshots of the Frama-C platform for source code analysis
http://frama-c.com
167 stars 38 forks source link

frama-c/wp and why3 #26

Closed abakst closed 3 years ago

abakst commented 5 years ago

Hello,

There appears to be an issue with some of the why3 files that get generated from user axiomatic definitions. I've installed frama-c using the nix-pkgs on the master branch, and hence have version 19.0, and why3 version 1.2.0.

/*@ axiomatic maps { type model_digit = octet | sextet; 
                     logic integer foo(model_digit i);
                   }
*/
int foo() {
//@assert \forall int i;  i == foo(octet);
  return 0;
}

Given the (silly) program above in simple.c, I get the following behavior

$ frama-c -wp -wp-prover z3-ce simple.c
[kernel] Parsing simple.c (with preprocessing)
[wp] Warning: Missing RTE guards
[wp] 1 goal scheduled
[wp] WPOUT/typed/A_maps.why:13: User Error: why3 syntax error
[wp] [z3-ce] Goal typed_foo_assert : Failed
  why3 syntax error
[wp] Proved goals:    0 / 1
  Why3 (z3-ce):    0  (failed: 1)
[wp] User Error: Deferred error message was emitted during execution. See above messages for more information.
[kernel] Plug-in wp aborted: invalid user input.

The A_maps.why file contains:

(* ---------------------------------------------------------- *)
(* --- Axiomatic 'maps'                                   --- *)
(* ---------------------------------------------------------- *)
theory A_maps

use bool.Bool
use int.Int
use int.ComputerDivision
use real.RealInfix
use Qed.Qed
use int.Abs as IAbs
use map.Map
type a_model_digit | c_octet | c_sextet

function l_foo a_model_digit : int

end

The error seems to be on the line (I'd imagine there should be an '=' but I am not a why3 user)

type a_model_digit | c_octet | c_sextet

Thanks!

maroneze commented 3 years ago

I just tried your code in the current development version of Frama-C (available at our public Gitlab repository), and I do not have any syntax errors (the goal is not proved, but WP behaves normally). The current Frama-C uses why3.1.4.0, which might explain it.

In any case, due to Frama-C's migration to Gitlab, and the fact that it is probably no longer relevant, it will be closed and assumed to be fixed/outdated. Please feel free to reopen it on our Gitlab issues page, or leave a comment here if the issue is still relevant, in which case we will migrate it to our Gitlab.