-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CN] specs on declarations have a different syntax from specs on definitions #371
Comments
I think the ideal way to resolve this would be to eliminate the distinction between |
Agreed, we should fix the CN frontend so the syntax for As commented on #467, |
The |
Bumping this issue as it's now also blocking work on the TA2 Mission Key Management example. Here's a distilled example of the problem (derived from
#include "libfile.h"
int foo(int i)
/*@
accesses myval;
requires myval == 1i32;
i == 1i32;
ensures return == 0i32;
@*/
{
if (i == myval) return 0;
else return 1;
}
#include "libfile.h"
int bar()
/*@
accesses myval;
@*/
{
myval = 0;
int i = foo(0);
}
int myval = 0;
int foo(int i);
// Should be able to write spec here We can't verify @cp526 @dc-mak and others in the CN team - this is a blocker on TA2 work for both @peterohanley and myself. Could you look at this and make an assessment about how difficult it would be to fix? |
On it. Apologies for the inconvenience. It's not just a grammar change - code needs to be moved from the frontend to the backend. Nothing conceptually difficult, best guess is that it will probably take a few (2-3) days. |
Thanks @dc-mak - once you have this in prototype, I have an example in the OpenSUT we can use to test it. |
@dc-mak also note there was some talk of removing the |
This is in preparation for unifying function definition and declaration specification parsing, as needed by #371.
DO NOT MERGE: temporary commit to share and test. This commit unifies the handling of definition and declaration specifications. Previously, decl specs did not support accesses, cn_function, or trusted. The requires and ensures clauses they did support was desugared in the frontend Lem code. This commit moves the desugaring of the decl specs to backend/cn, specifically Core_to_mucore.normalise_fun_map_decl, alongside the definition specs parsing and desugaring. It also moves the logic for combining multiple function specs into the same module, outside of Parse. Extra special care needs to be taken in figuring out which desugaring state to use. I'm not exactly sure about this bit, but it seems to be working (I think thanks to the add_spec_arg_renames).
DO NOT MERGE: temporary commit to share and test. This commit unifies the handling of definition and declaration specifications. Previously, decl specs did not support accesses, cn_function, or trusted. The requires and ensures clauses they did support was desugared in the frontend Lem code. This commit moves the desugaring of the decl specs to backend/cn, specifically Core_to_mucore.normalise_fun_map_decl, alongside the definition specs parsing and desugaring. It also moves the logic for combining multiple function specs into the same module, outside of Parse. Extra special care needs to be taken in figuring out which desugaring state to use. I'm not exactly sure about this bit, but it seems to be working (I think thanks to the add_spec_arg_renames).
Can you check out #892 and test it locally? The code's ready to go but I still need to add a few tests for the new behaviour. |
In particular
accesses
does not work buttrusted
also does not.Looking at the grammar in the documentation, it looks like a declaration spec should refer to
function_spec
rather than hardcode only requires and ensures.The text was updated successfully, but these errors were encountered: