-
Notifications
You must be signed in to change notification settings - Fork 62
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
Malloc struct special treatment inconsistent with the general scenario. #33
Comments
I don't see that. Note that for the To convert the |
Agreed, the assumptions may be weaker. |
|
VeriFast seems to handle calls like
malloc(sizeof(struct A))
specially, and generates thestruct A
-specific predicates right away for the successful allocation. On the other sidemalloc(size)
generates just an array of chars, which, to be converted into the structure fields, requires additional assumptions regarding the structure layout. Specifically:Here, first field assignments works, while the second case, first, requires the
sizeof(struct A) == (sizeof(int) + sizeof(int))
for successful allocation, and then will also needassume((void*)&two->y == (void*)&two->x + sizeof(int))
to convert the generatedchars
into two fieldsA::x
andA::y
.Long story short, for
malloc(sizeof(struct A))
VeriFast silently assumes some layout facts, which it does not assume in the general case.The text was updated successfully, but these errors were encountered: