Frama-c指针不兼容的类型

Fed*_*eXu 1 c frama-c

当我试图在Frama-c中运行我的简单代码时,我遇到了一些问题.我正在尝试创建一个指向数组结构的有效指针,并从我的函数返回此指针Stack_init.我不明白为什么Frama-c会返回此错误并且不能证明我的功能:

[kernel] preprocessing with "gcc -C -E -I.  /home/federico/Desktop/simple_main_v2.c"
[kernel] warning: Neither code nor specification for function malloc, generating default assigns from the prototype
[wp] Collecting axiomatic usage
[wp] warning: Missing RTE guards
Desktop/simple_main_v2.c:28:[wp] warning: Cast with incompatible pointers types (source: sint8*) (target: sint32*)
[wp] 0 goal scheduled
Run Code Online (Sandbox Code Playgroud)

我的目的是创建一个函数,返回一个没有前置条件的指针,后置条件是指针有效.

有人可以帮我理解我的错误在哪里吗?

/*
  create_stack

        Inputs: none
        Outputs: S (a stack)
        Preconditions: none
        Postconditions: S is defined and empty 
*/

/*@ 
    ensures  \valid(\result) && \result[0] == 0;
*/
int *Stack_Init()
{       
    int *stack = malloc (sizeof(int[100]));
    stack[0] = 0;               
    return stack;               
}
Run Code Online (Sandbox Code Playgroud)

Vir*_*ile 6

WP插件不能void *很好地支持指针,因为它的内部存储器模型依赖于声明元素的静态类型.这是您正在目睹的大部分错误.正如你在2078年所看到的,精确的记忆模型将在某些时候出现(Frama-C Magnesium版本)并提供一些帮助.

但是请注意,还有另一个问题malloc超出了支持void *,即对动态分配的内存(谓语支持fresh及其在ACSL兄弟姐妹),对此没有什么是此刻的真正规划为据我所知.