Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <43177F3F.5278D950@dessent.net> Date: Thu, 01 Sep 2005 15:22:55 -0700 From: Brian Dessent MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: BUG report: destructor exception vector; DLL 1.5.18 References: <431775C6 DOT 7040609 AT sdl DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Andreas wrote: > I compiled the same file on a LINUX system, it runs there without a problem. That is a very poor way to assume that your code is correct. When you make coding errors that trash memory, any one of a number of things can happen and the outcome completely depends on the compiler, the operating system, and so on. In other words, just because it doesn't segfault on linux doesn't mean it's correct. > ============================ > here is cygcheck -s -v -r > cygcheck.out > ============================ In the future please attach these, instead of including them inline. It makes your message easier to read and it makes the archives much more clean. > int idx = p->nameIdx.getIdx(name); > p->checked[idx]=true; And here is your bug. If 'name' does not exist in the list, getIdx() returns -1. Since you don't check this value, you try to set checked[-1]=true, which is out of bounds and an undefined operation. From here on out your program is uncharted waters - it could crash, it could run perfectly, it could do anything. In this case it's probably stomping on some part of the vtable which is why it dies when the destructor is run. If you add a test for idx == -1 to the code it runs fine with no segfault. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/