<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title></title>
</head>
<body>
<title></title>
<pre wrap=""></pre>
When replace the number of allocated entries by numberToAdd+1, Sbb works
fine.<br>
<br>
If try num=1, Q1 has no problem. But I still don't see why num=0 fails for
OsiRowCut while is fine for other data types.<br>
<br>
I checked my SbbModel.cpp status, it is up-to-date<span
 class="moz-smiley-s1"><span> :-) </span></span><br>
 <br>
 ===================================================================<br>
 File: SbbModel.cpp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Status: Up-to-date<br>
 <br>
 &nbsp;&nbsp; Working revision:&nbsp;&nbsp;&nbsp; 1.31<br>
 &nbsp;&nbsp; Repository revision: 1.31&nbsp;&nbsp;&nbsp; /usr/cvs/coin/COIN/Sbb/SbbModel.cpp,v<br>
 &nbsp;&nbsp; Sticky Tag:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (none)<br>
 &nbsp;&nbsp; Sticky Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (none)<br>
 &nbsp;&nbsp; Sticky Options:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (none)<br>
 <br>
 <br>
 Yan<br>
 <br>
 <br>
 <br>
 Laszlo Ladanyi wrote:<br>
 
<blockquote type="cite"
 cite="midPine.A41.4.21.0306191732490.24178-100000@oslpp.watson.ibm.com"> 
  
  <pre wrap="">Note that this is just guesswork since I do not use Windows.

I sort of hesitate to say this, but this suspiciously looks like a compiler
bug... From your Q2 it seems that the generated code has no problems deleting
the array when more than 0 was allocated to start with and crashes when 0 cuts
are allocated. An easy way to test this would be to replace the number of
allocated entries by num+1. If that helps then it's almost certainly a
compiler bug. Did you try your Q1 with num=1 ?

BTW, when did you download SBB? In the current version there is no 
'delete [] addCuts;' anywhere near line 1880 :-).

--Laci

On Thu, 19 Jun 2003, Yan Xu wrote:

  </pre>
   
  <blockquote type="cite">     
    <pre wrap="">Hi, I encounted some problems when using Sbb in Windows, compiler is MSVS6.0

Question 1: Why following code crashes when delete [] A, but declaring A 
as many other types (I tried int, char, ..., and some user-defined 
class) is fine? Is there a problem in OsiRowCut ?

#include &lt;iostream&gt;
#include "OsiRowCut.hpp"
using namespace std;

int main()
{
    int num = 0;

    OsiRowCut* A = new OsiRowCut [num];
//  int* A = new int [num];                          // OTHER TYPE IS FINE

    cout &lt;&lt; "num = " &lt;&lt; num &lt;&lt; endl;
    delete [] A;                                            // CRASH HERE
    return 0;
}


Question 2:  When running Sbb with input data file: fiber, dcmutli, it 
crashes. The place cause crash is line 1880 of SbbModel.cpp

                    delete [] addCuts;

After  print numberToAdd, something like:
.......
numberToAdd = 15
numberToAdd = 25
numberToAdd = 6
numberToAdd = 3
numberToAdd = 4
numberToAdd = 5
numberToAdd = 0  // CRASH AFTER THIS LINE

I found when numberToAdd is 0, 'delete' crashes, which brings the first 
question.

Anyone have some idea, thanks. By the way, I don't have these problems 
in my Linux machine.

Yan







_______________________________________________
Coin-discuss mailing list
<a class="moz-txt-link-abbreviated"
 href="mailto:Coin-discuss@www-124.ibm.com">Coin-discuss@www-124.ibm.com</a>
<a class="moz-txt-link-freetext"
 href="http://www-124.ibm.com/developerworks/oss/mailman/listinfo/coin-discuss">http://www-124.ibm.com/developerworks/oss/mailman/listinfo/coin-discuss</a>

    </pre>
   </blockquote>
   
  <pre wrap=""><!---->
_______________________________________________
Coin-discuss mailing list
<a class="moz-txt-link-abbreviated"
 href="mailto:Coin-discuss@www-124.ibm.com">Coin-discuss@www-124.ibm.com</a>
<a class="moz-txt-link-freetext"
 href="http://www-124.ibm.com/developerworks/oss/mailman/listinfo/coin-discuss">http://www-124.ibm.com/developerworks/oss/mailman/listinfo/coin-discuss</a>
  </pre>
 </blockquote>
 <br>
 <br>
 
<pre class="moz-signature" cols="$mailwrapcol">-- 
Yan Xu
PhD Student                                     | Tel:   610-758-4042
Department of Instrial and Systems Engineering  | Fax:   610-758-4886
Lehigh University                               | Email: <a
 class="moz-txt-link-abbreviated" href="mailto:yax2@lehigh.edu">yax2@lehigh.edu</a>
</pre>
 <br>
 
</body>
</html>