Skip to content
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

Code with returns inside conditionals, with code following, doesn't verify properly #32

Open
JonathanAldrich opened this issue May 21, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@JonathanAldrich
Copy link
Member

An if statement with a return statement inside it doesn't verify properly. The expected behavior is that all code after the if statement should be able to assume the branch with the return statement was not taken. The actual behavior is that a return statement compiles to a variable assignment and then the program doesn't actually return from there, it continues executing until the end of the function. This will cause code after the if statement to execute, and likely break.

I've attached a test case avl-bug3.c0.txt; the assertion //@ assert acc(N->left); on line 38 fails because the verifier thinks that N might be NULL, but that's impossible because in that case the function would already have returned.

This one is easy to work around when writing new short code examples with simple logic, but will be a pain in the neck when scaling up or trying to verify existing codebases.

@jennalwise
Copy link
Member

The problem in issue #31, is the same one documented here. In other words, solving this issue will also solve issue #31.

@jennalwise jennalwise added the enhancement New feature or request label May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants