<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;}
/* 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;}
span.EmailStyle17
{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">This is just a memory copy. Why is Duff’s device being used here?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hasn’t Duff’s device been obsoleted by modern compilers and machine architectures?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Not even mentioning that the code might not work, depending on how tricky the compiler tries to be about optimization.<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">Try recompiling CLP with minimal compiler optimization and see if the exception still happens.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">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></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">Manitoba Hydro<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""> Clp [mailto:clp-bounces@coin-or.org]
<b>On Behalf Of </b>usa usa<br>
<b>Sent:</b> Friday, May 13, 2016 11:07 AM<br>
<b>To:</b> clp@list.coin-or.org<br>
<b>Subject:</b> [Clp] CLP exception poped up when solving an LP<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi, I am using CLP to solve an LP with
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> rowNum = 1002 and columNum = 6202 and totalElementNum = 6,214,404<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><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">I got an exception: <o:p></o:p></p>
</div>
<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><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">The exception poped up at <br>
<br>
<b>case 2: *--downto = *--downfrom;</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><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="margin-bottom:12.0pt">I do not understand why this happed ?
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">I have used CLP to solve some large benchmark Lp models without problems.
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Any help would be appreciated. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">thanks!<o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>