From: Chris Jones Newsgroups: comp.os.msdos.djgpp Subject: SIGSEGV problem with DJGPP (deleting array) Date: Tue, 13 Apr 1999 22:24:49 GMT Organization: Deja News - The Leader in Internet Discussion Lines: 50 Message-ID: <7f0g7a$qg7$1@nnrp1.dejanews.com> NNTP-Posting-Host: 128.40.205.1 X-Article-Creation-Date: Tue Apr 13 22:24:49 1999 GMT X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 95) X-Http-Proxy: 1.1 x9.dejanews.com:80 (Squid/1.1.22) for client 128.40.205.1 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com (repost - I think my newsserver's having some problems. Apologies for any duplication) Hello - I'm having a few hassles with DJGPP and wondered if anyone on this NG could help. I've written a program which works fine when compiled and run with g++ on a Solaris machine, but exits when the same source is compiled and run with DJGPP. I've traced the problem to the function below (which had already been successfully called once before) - any ideas? The ESP is less than the EBP, which the FAQ suggests means the stack frame has been overrun. However I'm afraid I don't know enough to fix the problem - I've tried manually setting the stack size to no effect. Not that the prorgam should be using anywhere near that much memory. Playing around with the code, I think the error arises in the second delete command (on the second use of the function), but I've no idea why. Any help would be very much appreciated! TIA. (In the function, the variable size and values of ptr[i] seem to be read OK.) // add_element function void myVector::add_element() { double *ptr2= new double [size+1]; for(int i=0;i<(size+1);i++) { ptr2[i]=ptr[i]; } ptr2[size+1]=0; delete [] ptr; size=size+1; double *ptr=new double [size]; for(int i=0;i