From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15269 invoked by alias); 5 Aug 2008 09:31:54 -0000 Received: (qmail 15260 invoked by uid 22791); 5 Aug 2008 09:31:53 -0000 X-Spam-Check-By: sourceware.org Received: from yw-out-1718.google.com (HELO yw-out-1718.google.com) (74.125.46.153) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 05 Aug 2008 09:31:02 +0000 Received: by yw-out-1718.google.com with SMTP id 5so1299407ywm.26 for ; Tue, 05 Aug 2008 02:31:00 -0700 (PDT) Received: by 10.151.156.1 with SMTP id i1mr1072622ybo.117.1217928659799; Tue, 05 Aug 2008 02:30:59 -0700 (PDT) Received: by 10.150.96.7 with HTTP; Tue, 5 Aug 2008 02:30:59 -0700 (PDT) Message-ID: Date: Tue, 05 Aug 2008 09:31:00 -0000 From: "James Gregory" To: "Christoph Bartoschek" Subject: Re: Including affects whether or not program freezes? Cc: gcc-help@gcc.gnu.org In-Reply-To: <200808050845.44715.bartoschek@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <5cc6b04e0807090949g30d5aacckc170e6068093e5a4@mail.gmail.com> <200808050845.44715.bartoschek@gmx.de> Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-08/txt/msg00044.txt.bz2 On Tue, Aug 5, 2008 at 7:45 AM, Christoph Bartoschek wrote: >> So I guess "while (l_iter != l_end)" is becoming an infinite loop, but >> if I log the value of &(*l_iter) and &(*l_end) on each loop then a) it >> removes the bug and b) there is nothing obviously wrong. Anything else >> I can do? > > Did you find the bug? What was the problem? > > If you did not find it yet: > > 1. Check with a debugger that the while loop is indeed an endless loop. > 2. You did not show what containers l_iter and l_end come from and what > happens with the containers in this function. > > Christoph > I never did find the bug, no. 1. I thought gdb couldn't give accurate line numbers for optimized code? In this slightly modified version of my code (I was attempting to cut down the code as much as possible): bool get_true() { return true; } bool AIInterpreter::is_group_like_this(int n_side, int n_group) { if ((!get_true()) || !sides[my_side].scanned_groups[n_side][n_group] || !get_true()) { while (l_iter != l_end) ++l_iter; return false; } write_log(L"it never gets this far"); gdb says: Program received signal SIGINT, Interrupt. 0x0000000000404356 in AIInterpreter::is_group_like_this (this=0x659338, n_side=1, n_group=0) at src/AIInterpreter.cpp:388 388 if ((!get_true()) (gdb) bt #0 0x0000000000404356 in AIInterpreter::is_group_like_this (this=0x659338, n_side=1, n_group=0) at src/AIInterpreter.cpp:388 I can't see how it could freeze on that line? 2. l_iter and l_end are of type std::basic_string::const_iterator As for what happens to the container, the full source code for the cut-down version of the file is here: http://rrgbis.svn.sourceforge.net/viewvc/rrgbis/rrgbis-bug/src/AIInterpreter.cpp?view=markup And yes the code is a bit of a mess but hey I wrote that file years ago. The "rrgbis-bug" directory is/was my attempt to find the minimal amount of code required to make it freeze, though it's still almost 7000 lines of code in total, so I didn't really succeed. I am no longer subscribed to gcc-help, so if anyone wants me to see a reply please include me in the cc list. Thanks, James