Coq VST Internal structure copying

大兔子大兔子 提交于 2021-01-28 19:23:39

问题


run into a problem with VST(Verified Software Toolchain) 2.5v library for Coq 8.10.1:

Got an error with the latest working commit of VST namely "Internal structure copying is not supported". Minimal example:

struct foo {unsigned int a;};
struct foo f() {
struct foo q;
return q; }

On starting proof got an error:

Error: Tactic failure: The expression (_q)%expr contains internal structure-copying, a feature of C not currently supported in Verifiable C (level 97).

This is due to the check_normalized in floyd/forward.v :

Fixpoint check_norm_expr (e: expr) : diagnose_expr :=
match e with
| Evar _ ty => diagnose_this_expr (access_mode ty) e
...

So, the questions are:

1) What suggested workarounds exists?

2) What is the reason for this limitation?

3) Where can I get a list of unsupported features?


回答1:


1) The workaround is to change your C program to copy field by field.

2) The reason is the absurdly complicated and target-ISA-dependent implementation/semantics of C's structure-copying, especially in parameter passing and function-return.

3) The first 10 lines of Chapter 4 ("Verifiable C and clightgen") of the reference manual has a short list of unsupported features, but unfortunately struct-by-copy is not on that list. That's a bug.



来源:https://stackoverflow.com/questions/60710135/coq-vst-internal-structure-copying

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!