<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Robert,<br>
      <br>
      I agree.  I use CoinMemcpyN which is same as CoinCopyN unless
      -DUSE_MEMCPY defined when it uses memcpy - there is a remark at
      line 255 of CoinHelperFunctions.hpp.  So try defining USE_MEMCPY
      in your configuration and using CoinMemcpyN in your code.  If it
      still errors then it may be easier to see what is wrong.<br>
      <br>
      John Forrest<br>
      On 17/05/16 22:56, Lacroix, Robert wrote:<br>
    </div>
    <blockquote
      cite="mid:1622B4DAA9030849B750BC26B74D6F557E2177A7@mail2s2.hydro.mb.ca"
      type="cite">
      <meta http-equiv="Context-Type" content="text/html; charset=utf-8">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <div class="WordSection1">
        <p class="MsoNormal"><span>This is just a memory copy. Why is
            Duff’s device being used here?</span></p>
        <p class="MsoNormal"><span>Hasn’t Duff’s device been obsoleted
            by modern compilers and machine architectures?</span></p>
        <p class="MsoNormal"><span>Not even mentioning that the code
            might not work, depending on how tricky the compiler tries
            to be about optimization.</span></p>
        <p class="MsoNormal"><span> </span></p>
        <p class="MsoNormal"><span>Try recompiling CLP with minimal
            compiler optimization and see if the exception still
            happens.</span></p>
        <p class="MsoNormal"><span>Then tell us about the result. It
            will be of special interest to those of us that rely on CLP
            for decision support.</span></p>
        <p class="MsoNormal"><span> </span></p>
        <p class="MsoNormal"><span>Robert Lacroix</span></p>
        <p class="MsoNormal"><span>Manitoba Hydro</span></p>
        <p class="MsoNormal"><span> </span></p>
        <p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span
            lang="EN-US"> Clp [<a class="moz-txt-link-freetext" href="mailto:clp-bounces@coin-or.org">mailto:clp-bounces@coin-or.org</a>]
            <b>On Behalf Of </b>usa usa<br>
            <b>Sent:</b> Friday, May 13, 2016 11:07 AM<br>
            <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:clp@list.coin-or.org">clp@list.coin-or.org</a><br>
            <b>Subject:</b> [Clp] CLP exception poped up when solving an
            LP</span></p>
        <p class="MsoNormal"> </p>
        <div>
          <div>
            <p class="MsoNormal">Hi, I am using CLP to solve an LP with 
            </p>
          </div>
          <div>
            <p class="MsoNormal">   rowNum =  1002 and columNum = 6202 
              and totalElementNum = 6,214,404</p>
          </div>
          <div>
            <p class="MsoNormal"><br>
              In   <b>CoinCopyN</b> (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);</p>
          </div>
          <div>
            <p class="MsoNormal">I got an exception: </p>
          </div>
          <div>
            <p class="MsoNormal"><b><br>
                       Unhandled exception at 0x00217A52 in MyApp.exe:
                0xC0000005: Access  violation reading location
                0x1BBEFFFC.</b></p>
          </div>
          <div>
            <p class="MsoNormal">The exception poped up at <br>
              <br>
                  <b>case 2:         *--downto = *--downfrom;</b></p>
          </div>
          <div>
            <p class="MsoNormal"><br>
              template <class T> inline void<br>
              <b>CoinCopyN</b> (register const T* from, const int size,
              register T* to)<br>
              {<br>
                  if (size == 0 || from == to)<br>
                  return;<br>
              <br>
              #ifndef NDEBUG<br>
                  if (size < 0)<br>
                  throw CoinError("trying to copy negative number of
              entries",<br>
                          "CoinCopyN", "");<br>
              #endif<br>
              <br>
                  register int n = (size + 7) / 8;  <b>// size =
                6214404</b><br>
                  if (to > from) {<br>
                  register const T* downfrom = from + size;<br>
                  register T* downto = to + size;<br>
                  // Use Duff's device to copy<br>
                  switch (size % 8) {<br>
                  case 0: do{     *--downto = *--downfrom;<br>
                  case 7:         *--downto = *--downfrom;<br>
                  case 6:         *--downto = *--downfrom;<br>
                  case 5:         *--downto = *--downfrom;<br>
                  case 4:         *--downto = *--downfrom;<br>
                  case 3:         *--downto = *--downfrom;<br>
              <b>    case 2:         *--downto = *--downfrom;  //
                exception poped up here,</b><br>
                  case 1:         *--downto = *--downfrom;<br>
                  }while(--n>0);<br>
                  }</p>
          </div>
          <div>
            <p class="MsoNormal">I do not understand why this happed ?
            </p>
          </div>
          <div>
            <p class="MsoNormal">I have used CLP to solve some large
              benchmark Lp models without problems.
            </p>
          </div>
          <div>
            <p class="MsoNormal">Any help would be appreciated. </p>
          </div>
          <div>
            <p class="MsoNormal"> </p>
          </div>
          <div>
            <p class="MsoNormal">thanks!</p>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Clp mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Clp@list.coin-or.org">Clp@list.coin-or.org</a>
<a class="moz-txt-link-freetext" href="http://list.coin-or.org/mailman/listinfo/clp">http://list.coin-or.org/mailman/listinfo/clp</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>