[Cbc] UndefinedBehaviorSanitizer error in OsiPresolvewhen casting Status
Tobias Stengel
Tobias.Stengel at locom.de
Mon Nov 6 02:11:20 EST 2017
Did you fix the errors upstream? If not: can you post a list of the errors you found so others can apply the fixes locally and/or John (or whoever else is allowed to do it) can fix them in trunk?
I ran GCC undefinedBehaviourSanitizer some time ago and found some issues which are partly fixed upstream, but missed the one with the Status enum.
I am interested how you fixed the integer overflow in the gomory cut generator as John’s fix in trunk just moved the problem a few lines down causing us to use „-gomory off“ all the time as we are using CBC as a libary and can not risk CBC killing or corrupting the process it runs in. This does not improve performance…
Tobias
Von: Cbc [mailto:cbc-bounces at coin-or.org] Im Auftrag von Petter Strandmark
Gesendet: Samstag, 21. Oktober 2017 17:09
An: cbc at list.coin-or.org
Betreff: [Cbc] UndefinedBehaviorSanitizer error in OsiPresolvewhen casting Status
I am compiling and running Cbc with Clang’s UndefinedBehaviorSanitizer. I have been able to fix several errors, but a more tricky one is the following. This line sometimes incorrecly casts an enum:
<https://github.com/coin-or/Osi/blob/master/Osi/src/Osi/OsiPresolve.cpp#L505>
https://github.com/coin-or/Osi/blob/master/Osi/src/Osi/OsiPresolve.cpp#L505
The original enum looks like:
/*! \brief Enum for status of various sorts
Matches CoinWarmStartBasis::Status and adds superBasic. Most code that
converts between CoinPrePostsolveMatrix::Status and
CoinWarmStartBasis::Status will break if this correspondence is broken.
superBasic is an unresolved problem: there's no analogue in
CoinWarmStartBasis::Status.
*/
enum Status {
isFree = 0x00,
basic = 0x01,
atUpperBound = 0x02,
atLowerBound = 0x03,
superBasic = 0x04
};
and the target enum looks like:
enum Status {
isFree = 0x00, ///< Nonbasic free variable
basic = 0x01, ///< Basic variable
atUpperBound = 0x02, ///< Nonbasic at upper bound
atLowerBound = 0x03 ///< Nonbasic at lower bound
};
UndefinedBehaviorSanitizer stops the execution because the status is superBasic.
The question is, what is the correct course of action in that case?
Petter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20171106/7e4bb627/attachment-0001.html>
More information about the Cbc
mailing list