Skip to content

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

Open
@john-h-kastner

Description

@john-h-kastner
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).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions