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

Use longest match during ACSL variable back-substitution #5

Closed
wants to merge 1 commit into from

Conversation

gustavung
Copy link

If we have more than 10 variables to replace in the ACSL back-substitution, then e.g. _15 will be mistaken for _1. Suppose that our zipped seq is defined as: {(x, 1),...,(y, _),...,(a, 15)}. This results in odd terms like x5 = y instead of a = y. The solution is to reverse the seq and make sure that we replace the longest matches first.

I'll try to create a regression test next week.

@zafer-esen
Copy link
Collaborator

@gustavung thanks for this PR! Indeed a regression test would be nice to have!

We should probably refactor the ACSL back-translator to not use a brittle string replacement at all, eventually.

@zafer-esen
Copy link
Collaborator

@gustavung I think it would be good to have this fix in TriCera even without any tests. I can land the PR if you give the green light.

@zafer-esen
Copy link
Collaborator

@gustavung I missed your thumbs up in my previous comment, so this PR was still sitting open, sorry for that!

#10 eliminates the brittle string replacement used during back-translation, so I am closing this PR.

@zafer-esen zafer-esen closed this Feb 28, 2024
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.

2 participants