-
Notifications
You must be signed in to change notification settings - Fork 711
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
Test failures when building with clang #939
Comments
Potential solution in #940 |
This might help too #932 |
I am aware of the issue. |
@facontidavide |
Thanks for fixing @facontidavide! For the record, I think you were looking at Picknik's fork in PickNikRobotics#6 where we haven't gotten around to fixing the windows build because we don't support it. I don't think #940 would've shown the same failures. |
Describe the bug
When building with clang on master, tests are failing with c++ exception:
C++ exception with description "Value outside numeric limits" thrown in the test body.
Any.Cast
appears to be the most minimal testcase that is failing. It comes down to casts from any integral type to a double type.How to Reproduce
Please provide a specific description of how to reproduce the issue or source code that can be compiled and executed. Please attach a file/project that is easy to compile, don't copy and paste code snippets!
From project root:
Root cause
I've found that the root cause is in checkTruncation
In particular if
To
has a larger max value thanFrom
(say for exampleTo
isdouble
andFrom
isint
),static_cast<From>(std::numeric_limits<To>::max())
does not always evaluate to the max value ofFrom
. In clang, with any optimization (I see behaviortree.cpp is built with-O3
), this evaluates to 0. I am not sure if this is meant to be undefined behavior but it sure is acting like it.The text was updated successfully, but these errors were encountered: