[Cbc] UndefinedBehaviorSanitizer error in OsiPresolvewhen casting Status

John Forrest john.forrest at fastercoin.com
Thu Nov 9 11:01:42 EST 2017


Petter,

Added superBasic to enum.  Does not seem to alter anything.  I have 
fixed a few other things in CoinUtils.

I am looking at divides by zero etc in cut generators.  I am also 
looking at CglGomory to try and fix things for Tobias.  On my runs there 
were no problems but I am not happy with my coding.  So I am testing 
using CoinRational as that way it will be easier for people to stress 
that.  I don't think CoinRational had ever been used as it had serious 
bugs - which I think I have fixed.

I will update Cgl when I have finished my tests.  The divide by zeros 
don't seem to be fatal, but they do change behaviour.

John Forrest


On 21/10/17 16:09, Petter Strandmark wrote:
> 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
>
>
>
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org
> https://list.coin-or.org/mailman/listinfo/cbc


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20171109/deb61479/attachment.html>


More information about the Cbc mailing list