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

Don't generate redundant assertion in doPtrAddOffset when offset = 0. #344

Closed
wants to merge 1 commit into from

Conversation

brianhuffman
Copy link
Contributor

Now doPtrAddOffset only asserts pointer validity of the result when
it actually produces a new pointer; if the offset is a concrete zero,
then it returns the original pointer which was already assumed to be
valid.

Fixes GaloisInc/saw-script#585.

Now `doPtrAddOffset` only asserts pointer validity of the result when
it actually produces a new pointer; if the offset is a concrete zero,
then it returns the original pointer which was already assumed to be
valid.

Fixes GaloisInc/saw-script#585.
@brianhuffman
Copy link
Contributor Author

I'm actually not entirely convinced that this is the best way to solve the problem. It might also make sense to detect getelementptr array indexing at index 0, and just avoid generating the LLVM_PtrAddOffset instruction in the Crucible CFG in that case.

@brianhuffman
Copy link
Contributor Author

After talking with @robdockins, I think we should probably solve this problem a different way. This PR makes doPtrAddOffset have a kind of weird implicit precondition that either the offset is nonzero OR the input pointer was already asserted to be valid.

It will be better to change the llvm-to-crucible translation to skip the LLVM_PtrAddOffset when used with size 0. I'll make a separate pull request following that approach.

@brianhuffman brianhuffman deleted the saw-script-issue585 branch December 18, 2019 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Struct field accesses generate duplicate proof obligations for pointer validity
1 participant