-
Notifications
You must be signed in to change notification settings - Fork 59
Unexpectedly long run times on a short example containing floats #243
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
Comments
Interesting - I have a few things to investigate here. But at a minimum, |
Yes, the fact that it doesn't terminate is a regression where we lost our default timeout for
Looks like the pure float version gives me two paths now. Perhaps one piece of advice is to try and avoid int-float conversions. Another tactic is to call cover on variants of the function that supply some concrete values ... hopefully enough to remove the nonliear-ness of the problem. CrossHair has some minimal support for falling back to concrete-symbolic hybrid runs, where only some arguments are symbolic. In theory, that strategy should be able to help with paths like this, but the heuristics that guide it are too primitive to help here. I've filed #245 for investigating this further.
In #242, we were taking the square root and then immediately returning it. In that situation, CrossHair first picks values tfor the arguments and then the return value. Sometimes, when the arguments are heavily constrained, z3 can solve the square root just by simplification, so that's what happens there. OTOH, when we have to execute |
Expected vs actual behavior
I'm applying
cover
to the following code. It differs from the code in issue #242 in that thatround(area, 2)
is applied toarea
before returning it.When I run it via
cover -v --example_output_format arg_dictionary triangle_area_with_round.triangle_area
it runs indefinitely, constantly creating new formulae to send to z3. It seems z3 pretty quickly responds with 'Unknown' in each case. Based on this Z3 issue, I am assuming the problem here is due to incompleteness in Z3 when int and float types are mixed in non-linear arithmetic. What I was wondering is, should cover detect this and just terminate the path so that it doesn't run forever?If I change the types of the arguments to all be floats then
cover
stalls at the first query to z3. I am guessing this is because z3 is entering a different solver, which doesn't return 'Unknown' but is just very slow.e.g.
I've left this run for about 10 mins but not received a solution. I am guessing there isn't much you can do about this, but thought I'd report it anyway in case you see something odd that is fixable. Any suggestions on any changes I could make to the code, or to the arguments to
cover
to analyse this code?One final question I had is, could you explain why adding in the call to
round
results in this code behaving differently to what I reported in #242 ?Thanks!
The text was updated successfully, but these errors were encountered: