Skip to content

Checked-c-convert: function return values converted, but caller assigns it to variable of old type #523

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

Closed
AnnaKornfeldSimpson opened this issue Jul 11, 2018 · 1 comment
Assignees
Labels
bug This labels issues that are bugs.

Comments

@AnnaKornfeldSimpson
Copy link
Collaborator

AnnaKornfeldSimpson commented Jul 11, 2018

If a function return value is converted from * to _Ptr, callers of that function must be aware of that change and either cast the return value back or change the type of the variable to which they are assigning the return value. If that does not happen there will be an incompatible types error.

Example: parson.checked.c:360
The converted function is declared at: parson.checked.c:94
Original code: parson.c:360
Original function declaration: parson.c:94
Error Produced: assigning to <leftside_type> from incompatible type .

To use this test case:

  • Clone https://github.com/AnnaKornfeldSimpson/parson
  • Check out the snapshotWeUse branch
  • make test to build the original code. make testchecked to build with the copies produced by checked-c-convert.
  • convert.sh runs checked-c-convert on the original code and outputs to *checked* files. If you re-run it, also edit parson.checked.c to use parson.checked.h. convert.sh may need modifications to run in Windows.
  • Compiler errors can be compared with compilerErrors.txt (produced on a Ubuntu system, not sure if it will perfectly match in Windows)
@awruef awruef self-assigned this Jul 16, 2018
@dtarditi dtarditi added the bug This labels issues that are bugs. label Nov 6, 2018
@dtarditi
Copy link
Member

dtarditi commented Sep 2, 2019

The convert tool has been mostly rewritten (see PR #642). Please reopen this issue if it still exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This labels issues that are bugs.
Projects
None yet
Development

No branches or pull requests

3 participants