[Clp] CLP exception poped up when solving an LP

Lacroix, Robert ralacroix at hydro.mb.ca
Tue May 17 17:56:48 EDT 2016


This is just a memory copy. Why is Duff’s device being used here?
Hasn’t Duff’s device been obsoleted by modern compilers and machine architectures?
Not even mentioning that the code might not work, depending on how tricky the compiler tries to be about optimization.

Try recompiling CLP with minimal compiler optimization and see if the exception still happens.
Then tell us about the result. It will be of special interest to those of us that rely on CLP for decision support.

Robert Lacroix
Manitoba Hydro

From: Clp [mailto:clp-bounces at coin-or.org] On Behalf Of usa usa
Sent: Friday, May 13, 2016 11:07 AM
To: clp at list.coin-or.org
Subject: [Clp] CLP exception poped up when solving an LP

Hi, I am using CLP to solve an LP with
   rowNum =  1002 and columNum = 6202  and totalElementNum = 6,214,404

In   CoinCopyN (register const T* from, const int size, register T* to) called from CoinMemcpyN(ind,numels,index_), which is called from gutsOfOpEqual(colordered, minor, major, numels, elem, ind, start, len);
I got an exception:

       Unhandled exception at 0x00217A52 in MyApp.exe: 0xC0000005: Access  violation reading location 0x1BBEFFFC.
The exception poped up at

    case 2:         *--downto = *--downfrom;

template <class T> inline void
CoinCopyN (register const T* from, const int size, register T* to)
{
    if (size == 0 || from == to)
    return;

#ifndef NDEBUG
    if (size < 0)
    throw CoinError("trying to copy negative number of entries",
            "CoinCopyN", "");
#endif

    register int n = (size + 7) / 8;  // size = 6214404
    if (to > from) {
    register const T* downfrom = from + size;
    register T* downto = to + size;
    // Use Duff's device to copy
    switch (size % 8) {
    case 0: do{     *--downto = *--downfrom;
    case 7:         *--downto = *--downfrom;
    case 6:         *--downto = *--downfrom;
    case 5:         *--downto = *--downfrom;
    case 4:         *--downto = *--downfrom;
    case 3:         *--downto = *--downfrom;
    case 2:         *--downto = *--downfrom;  // exception poped up here,
    case 1:         *--downto = *--downfrom;
    }while(--n>0);
    }
I do not understand why this happed ?
I have used CLP to solve some large benchmark Lp models without problems.
Any help would be appreciated.

thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/clp/attachments/20160517/06ea0dce/attachment.html>


More information about the Clp mailing list