Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Frama-C: Creating a ghost field in a non-ghost structure

My goal is to create a ghost field in a non-ghost structure. What I understand from the ACSL manual (v.1.17) is, that this is possible in ACSL:

If a structure has ghost fields, the sizeof of the structure is the same as the structure without ghost fields. Also, alignment of fields remains unchanged. (p. 82)

So my questions are:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  1. How does a valid ACSL annotation look like to create a ghost field in a non-ghost structure?
  2. Is it possible to programmatically create a ghost field as well?

I’m currently using Frama-C 25.0-beta (installed via opam).

Edit: added ACSL version

>Solution :

First of all, ghost fields in non-ghost structures are currently not supported by Frama-C, as mentioned in the ACSL implementation manual (https://www.frama-c.com/download/frama-c-acsl-implementation.pdf p84). So basically, it is impossible to write one that would be correctly handled by Frama-C and its plugins. Thus, about your second question, it is currently not possible and requires changes in both the Frama-C kernel and the plugins.

About your first question, if we follow the ACSL manual, it would something like this:

struct S {
  int f ;
};

/*@ ghost struct S {
  int g ;
};
*/

However, since (as far as I know) it is not implemented anywhere today, I think it could (and probably should) change when it will be implemented.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading