我是 Frama-C 框架的新手,我正在尝试使用 C 程序进行一些合同测试。我打算为此使用 E-ACSL 插件,并尝试了一个测试程序来查看它是如何工作的,但是我得到了一些编译错误。这是我的代码:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int x = 0;
/*@ assert x == 1;*/
/*@ assert x == 0;*/
return 0;
}
然后,这里是 Frama-C 注释的代码:
/* Generated by Frama-C */
#include "stdio.h"
#include "stdlib.h"
struct __e_acsl_mpz_struct {
int _mp_alloc ;
int _mp_size ;
unsigned long *_mp_d ;
};
typedef struct __e_acsl_mpz_struct __e_acsl_mpz_struct;
typedef __e_acsl_mpz_struct ( __attribute__((__FC_BUILTIN__)) __e_acsl_mpz_t)[1];
/*@ ghost extern int __e_acsl_init; */
/*@ ghost extern int __e_acsl_internal_heap; */
extern size_t __e_acsl_heap_allocation_size;
/*@
predicate diffSize{L1, L2}(ℤ i) =
\at(__e_acsl_heap_allocation_size,L1) -
\at(__e_acsl_heap_allocation_size,L2) ≡ i;
*/
int main(void)
{
int __retres;
int x = 0;
/*@ assert x ≡ 1; */ ;
/*@ assert x ≡ 0; */ ;
__retres = 0;
return __retres;
}
最后,我尝试使用gcc和手册指示的标志(第 13 页)对其进行编译,但出现以下错误(和警告):
$ gcc monitored_second.c -o monitored_second -leacsl -leacsl-gmp -leacsl -jemalloc -lpthread -lm
monitored_second.c:10:1: warning: ‘__FC_BUILTIN__’ attribute directive ignored [-Wattributes]
typedef __e_acsl_mpz_struct ( __attribute__((__FC_BUILTIN__)) __e_acsl_mpz_t)[1];
monitored_second.c:18:55: warning: ‘__FC_BUILTIN__’ attribute directive ignored [-Wattributes]
int line);
^
monitored_second.c:25:60: warning: ‘__FC_BUILTIN__’ attribute directive ignored [-Wattributes]
size_t ptr_size);
^
/usr/bin/ld: cannot find -leacsl
/usr/bin/ld: cannot find -leacsl-jemalloc
collect2: error: ld returned 1 exit status
我还删除了“-rtl-bittree”标签,因为它返回另一个错误。
Frama-C 版本是最新的:Sulfur-20171101 知道发生了什么吗?
谢谢!