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

Mixed non-null/maybe-null malloc semantics in a same program #732

Open
nunoplopes opened this issue Jun 21, 2021 · 0 comments
Open

Mixed non-null/maybe-null malloc semantics in a same program #732

nunoplopes opened this issue Jun 21, 2021 · 0 comments
Labels
memory Memory Model

Comments

@nunoplopes
Copy link
Member

Example from @aqjune so we don't forget:

p = malloc(4)
q = malloc(4)
*p = 10
// can't remove this check
if (q == null) return 1;
*q = 20;
return 2;

=>

p = malloc(4)
q = malloc(4)
*p = 10
*q = 20;
return 2;

always succeed semantics: transformation correct
non-det null semantics: correct, as p is dereferenced

Our model assumes the program uses one model consistently, while the program above mixes models.

  1. Do we care about this example?
  2. If so, what's the fix? Synchronize mallocs between src/tgt?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
memory Memory Model
Projects
None yet
Development

No branches or pull requests

1 participant