-
Notifications
You must be signed in to change notification settings - Fork 534
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
Potential overflows detected by Prusti #974
Comments
While looking into this, I stumbled over how to deal with cases, where potential overflow is detected by prust, but considering the actual range of parameters can never happen. E.g. consider
Since the allowed year range is |
I have marked all detected code pieces and added some fixes here: https://github.com/xemwebe/chrono.git |
Thanks @xemwebe . Can you post a direct link to the diff that maintainers should look at? |
@jtmoon79 : sure, here is the link: https://github.com/xemwebe/chrono/compare/main..fix-overflows |
Also, these methods
seem to duplicate the methods of the There is also the issue, that all cases of diversions |
I have updated my findings. |
At first glance, that seems a reasonable way to slowly introduce more safety, and matches the approach done for dates. I'd wait for @djc and/or @esheppa chime in.
I know what you're getting at but it would help me if you created a new Draft PR or your own new branch to demonstrate exactly your intent. Could that be done?
Is this covered by your latest code in fn safe_mod(self, other: Self) -> Self { |
So I think the current plan is to redefine |
In the latest PR's I've defined it using |
Yes, of course, I could try if this would work without problems.
Yes, but only for |
Which PR is this? |
|
update after some overflows have been fixed by merge to 0.4.x This rises a question: What merge policy do you follow with respect to 0.4.x, 0.5.x, and main? Is 0.4.x regularly merged to 0.5-alpha, which will eventually be merged to main? |
I was trying to prepare a PR for at least those fixes that are not related to |
List of all the potential overflows in this issue and their status:
It is curious that this didn't catch the overflows in #1048 and #1093. |
Awesome work, thanks. |
See https://github.com/viperproject/prusti-dev.
The text was updated successfully, but these errors were encountered: