Skip to content

Function contracts can be attached to function pointers as parameters #7070

@nwetzler

Description

@nwetzler

CBMC version: 5.63.0
Operating system: macOS 11.6.6
Exact command line resulting in the issue:
main.c

typedef void (*fun_ptr_t)(int x);

void bar(int x) {
  return;
}

void foo(void (*fun_ptr)(int x) __CPROVER_requires(x != 0)) {
  return;
}

void main() {
  fun_ptr_t fun_ptr = bar;
  foo(fun_ptr);
  return;
}

cbmc main.c

What behaviour did you expect:
Expected behavior is that a parsing error should occur.

What happened instead:
Function contracts are parsed and assigned to function pointer declarators in function parameters.

Metadata

Metadata

Assignees

Labels

Code ContractsFunction and loop contractsawsBugs or features of importance to AWS CBMC users

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions