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

Array bounds on function returns use incorrect identifiers when function declarations use different parameter names #742

Open
john-h-kastner opened this issue Nov 16, 2021 · 0 comments

Comments

@john-h-kastner
Copy link
Collaborator

john-h-kastner commented Nov 16, 2021

int *foo(int *b, int l);
int *foo(int *a, int j) {
  for (int i = 0; i < j; j++)
    a[i];
  return a;
}

converts to

_Array_ptr<int> foo(_Array_ptr<int> b : count(l), int l) : count(l);
_Array_ptr<int> foo(_Array_ptr<int> a : count(j), int j) : count(l) {
  for (int i = 0; i < j; j++)
    a[i];
  return a;
}

The bound count(l) on the function definition must instead be count(j).

This is one part an issue noticed by @mattmccutchen-cci that applies to 3C before the lower bound inference changes. The other issue existed only after the changes and is fixed on that branch (infer_lower_bound).

@john-h-kastner john-h-kastner changed the title Array bounds on function returns use incorrect identifiers when multiple function declarations use different parameter names Array bounds on function returns use incorrect identifiers when function declarations use different parameter names Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant