我正在尝试在 printf 调用中对以下程序进行切片:
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
if (argc < 3) return 1;
int x = atoi(argv[1]);
int y = atoi(argv[2]);
printf("%d %d\n", x, y);
return 0;
}
但是,价值分析插件会给出以下消息:
foo.c:9:[value] 函数调用表达式参数 (char const ) (argv + 2)的评估中的非终止,
切片的程序是空的!这是 Frama-C 中的错误/功能吗?还是我做错了什么?
这是一个完整的跟踪:
$ frama-c -slice-calls printf foo.c -then-on 'Slicing export' -print
[slicing] slicing requests in progress...
[kernel] preprocessing with "gcc -C -E -I. foo.c"
[value] Analyzing a complete application starting at main
[value] Computing initial state
[value] Initial state computed
[value] Values of globals at initialization
foo.c:8:[kernel] warning: out of bounds read. assert \valid(argv+1);
[value] computing for function atoi <- main.
Called from foo.c:8.
[kernel] warning: No code for function atoi, default assigns generated
[value] Done for function atoi
foo.c:9:[kernel] warning: out of bounds read. assert \valid(argv+2);
foo.c:9:[value] Non-termination in evaluation of function call expression argument
(char const *)*(argv + 2)
[value] Recording results for main
[value] done for function main
[slicing] making slicing project 'Slicing'...
[slicing] interpreting slicing requests from the command line...
[slicing] applying all slicing requests...
[slicing] applying 0 actions...
[slicing] exporting project to 'Slicing export'...
[slicing] applying all slicing requests...
[slicing] applying 0 actions...
[sparecode] remove unused global declarations from project 'Slicing export tmp'
[sparecode] removed unused global declarations in new project 'Slicing export'
/* Generated by Frama-C */