<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas","serif";
        mso-fareast-language:EN-CA;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-CA;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-CA" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Read the source, Luke.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">According to CoinHelperFunctions.hpp<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">USE_MEMCPY is unavailable to code compiled by Microsoft C++ because _MSC_VER is defined by the compiler. This is the reason the previous suggestion doesn’t
 work.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">There is a comment that CoinMemcpy (which just calls CoinMemcpyN) throws an exception if you are trying to copy overlapping arrays. This is something worth
 checking. Look to see if you have incorrect or mis-ordered arguments in a function call.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I also note a comment which says the compiler may produce better code if you define COIN_USE_RESTRICT in the configuration when building CoinUtils. If this
 is an improvement, why isn’t it the default? In Linux I would set an environment variable in the shell (export CXXDEFS=-DCOIN_USE_RESTRICT) before running the “configure” script for CLP, but I don’t know how you would do that in Visual Studio.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Robert Lacroix<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> usa usa [mailto:usact2012@gmail.com]
<br>
<b>Sent:</b> Wednesday, May 18, 2016 9:15 AM<br>
<b>To:</b> John Forrest; Lacroix, Robert<br>
<b>Cc:</b> clp@list.coin-or.org<br>
<b>Subject:</b> Re: [Clp] CLP exception poped up when solving an LP<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">After recompiled all libs, I got the exception same as the original one:
<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><br>
       Unhandled exception at 0x00217A52 in MyApp.exe: 0xC0000005: Access  violation reading location 0x1BBEFFFC.</b><br>
<br>
even though I have defined USE_MEMCPY in CoinHelperFunctions.hpp and disabled all compile optimization for speed for all Clp libs.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">thanks<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Wed, May 18, 2016 at 9:45 AM, usa usa <<a href="mailto:usact2012@gmail.com" target="_blank">usact2012@gmail.com</a>> wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">Hi, <br>
<br>
I have defined USE_MEMCPY in CoinHelperFunctions.hpp and disabled all compile optimization for speed for all Clp libs. When I run myApp.exe in debug mode from Visual Studio 2013, I got error:
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<b>      Unhandled exception at 0x7541C54F in myApp.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">which is different from last error.
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">It seems that a NULL pointer is dereference ? <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Thanks, <br>
<br>
<o:p></o:p></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Wed, May 18, 2016 at 3:56 AM, John Forrest <<a href="mailto:john.forrest@fastercoin.com" target="_blank">john.forrest@fastercoin.com</a>> wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">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<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><br>
On 17/05/16 22:56, Lacroix, Robert wrote:<o:p></o:p></p>
</div>
</div>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">This is just a memory copy. Why is Duff’s device being used here?<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hasn’t Duff’s device been obsoleted by modern compilers and machine architectures?<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Not even mentioning that the code might not work, depending on how tricky the compiler tries to be about optimization.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Try recompiling CLP with minimal compiler optimization and see if the exception still happens.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Then tell us about the result. It will be of special interest to those of us that rely on CLP for decision support.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Robert Lacroix<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Manitoba Hydro<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Clp [<a href="mailto:clp-bounces@coin-or.org" target="_blank">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 href="mailto:clp@list.coin-or.org" target="_blank">clp@list.coin-or.org</a><br>
<b>Subject:</b> [Clp] CLP exception poped up when solving an LP</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hi, I am using CLP to solve an LP with 
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">   rowNum =  1002 and columNum = 6202  and totalElementNum = 6,214,404<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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);<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I got an exception:
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><br>
       Unhandled exception at 0x00217A52 in MyApp.exe: 0xC0000005: Access  violation reading location 0x1BBEFFFC.</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">The exception poped up at
<br>
<br>
    <b>case 2:         *--downto = *--downfrom;</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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>
    }<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I do not understand why this happed ?
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I have used CLP to solve some large benchmark Lp models without problems.
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Any help would be appreciated.
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">thanks!<o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
</div>
</div>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Clp mailing list<o:p></o:p></pre>
<pre><a href="mailto:Clp@list.coin-or.org" target="_blank">Clp@list.coin-or.org</a><o:p></o:p></pre>
<pre><a href="http://list.coin-or.org/mailman/listinfo/clp" target="_blank">http://list.coin-or.org/mailman/listinfo/clp</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Clp mailing list<br>
<a href="mailto:Clp@list.coin-or.org" target="_blank">Clp@list.coin-or.org</a><br>
<a href="http://list.coin-or.org/mailman/listinfo/clp" target="_blank">http://list.coin-or.org/mailman/listinfo/clp</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>