[Coin-discuss] CoinRowCut and Sbb problems in MSVS 6.0

Laszlo Ladanyi ladanyi at us.ibm.com
Thu Jun 19 17:45:13 EDT 2003


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:

> 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 <iostream>
> #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 << "num = " << num << 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
> Coin-discuss at www-124.ibm.com
> http://www-124.ibm.com/developerworks/oss/mailman/listinfo/coin-discuss
> 




More information about the Coin-discuss mailing list