[Cbc] UndefinedBehaviorSanitizer error in OsiPresolvewhen casting Status

John Forrest john.forrest at fastercoin.com
Thu Nov 9 12:47:49 EST 2017


Tobias,

I fixed some flaws in CglGomory and so have left it not using 
CoinRational.  You can make it use CoinRational - in configure 
-DUSE_CGL_RATIONAL=10000 would allow CoinRational to look at rationals 
a/b where a and b <10000.  But it seemed to give worse cuts.

Can you see if revised code is better for you.

John
On 06/11/17 07:11, Tobias Stengel wrote:
>
> 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://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_coin-2Dor_Osi_blob_master_Osi_src_Osi_OsiPresolve.cpp-23L505&d=DwMGaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=js2M0T-3OIMIVDvokcKjokJbk0F8QOCd0mT4FsVFE88&m=teKOXve84TjS7gbIwqEbWfnaIOzGDTDsf9SfQkpv4wY&s=b8lmOKUNw4GSde1lht9ZfVbODNNYFmLQZs33amHrjbc&e=>
>
> https://github.com/coin-or/Osi/blob/master/Osi/src/Osi/OsiPresolve.cpp#L505 
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_coin-2Dor_Osi_blob_master_Osi_src_Osi_OsiPresolve.cpp-23L505&d=DwMGaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=js2M0T-3OIMIVDvokcKjokJbk0F8QOCd0mT4FsVFE88&m=teKOXve84TjS7gbIwqEbWfnaIOzGDTDsf9SfQkpv4wY&s=b8lmOKUNw4GSde1lht9ZfVbODNNYFmLQZs33amHrjbc&e=>
>
> 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://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_cbc&d=DwICAg&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=js2M0T-3OIMIVDvokcKjokJbk0F8QOCd0mT4FsVFE88&m=teKOXve84TjS7gbIwqEbWfnaIOzGDTDsf9SfQkpv4wY&s=PxWdI-q__Dwz_9r7AKzvZEenOwNHYtI4hfwaikE3vz8&e=


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


More information about the Cbc mailing list