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

C-style cast not converted when result is not assigned to a pointer #722

Open
john-h-kastner opened this issue Oct 8, 2021 · 1 comment
Labels

Comments

@john-h-kastner
Copy link
Collaborator

void test() {
  int *a;
  if (a == (int*) 0)
    return;
}

converts to

void test() {
  _Ptr<int> a = ((void *)0);
  if (a == (int*) 0)
    return;
}

The cast (int*) is not converted to (_Ptr<int>), but this is required before the function can be _Checked. This creates a bit more manual work when converting code with 3C.

@john-h-kastner
Copy link
Collaborator Author

The fix: constraints variables for CStyleCastExprs are currently created by ConstraintResolver in getExprConstraintVars, but getExprConstraintVars is only called when we need to get constraint variables for assignment expressions (and a few other places). Instead, cast expressions could be visited by the VarAdder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant