From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16621 invoked by alias); 9 Jul 2008 11:28:52 -0000 Received: (qmail 16604 invoked by uid 22791); 9 Jul 2008 11:28:51 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 09 Jul 2008 11:28:32 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KGXqS-0001Qq-Ib for gcc-help@gcc.gnu.org; Wed, 09 Jul 2008 11:28:24 +0000 Received: from cpc1-brig6-0-0-cust995.brig.cable.ntl.com ([81.96.175.228]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 09 Jul 2008 11:28:24 +0000 Received: from lionelb.nospam by cpc1-brig6-0-0-cust995.brig.cable.ntl.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 09 Jul 2008 11:28:24 +0000 To: gcc-help@gcc.gnu.org From: Lionel B Subject: Re: Including affects whether or not program freezes? Date: Wed, 09 Jul 2008 12:03:00 -0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User-Agent: Pan/0.132 (Waxed in Black) X-IsSubscribed: yes 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-07/txt/msg00109.txt.bz2 On Wed, 09 Jul 2008 03:31:35 +0100, James Gregory wrote: > 1. Compile with MSVC 7.1, no optimization: my program doesn't freeze 2. > Compile with MSVC 7.1, with optimization: my program doesn't freeze 3. > Compile with gcc 4.2.3 (Ubuntu 64 bit), no optimization: my program > doesn't freeze > 4. Compile with gcc 4.2.3 (Ubuntu 64 bit), with optimization: my program > freezes in a particular function 5. Compile with gcc 4.2.3 (Ubuntu 64 > bit), with optimization, and include at the top of the file > where the function which freezes is defined: my program doesn't freeze You give *way* too little information to even begin to guess what the problem might be... but this smells like a classic case of Undefined Behaviour - sometimes it appears to work, sometimes it doesn't. I.e. you have a bug in your program. > Debugging this is difficult. It frequently is ;-) but what other choice do you have? There are tools to help (debuggers such as gdb, memory leak checkers such as valgrind, ...) First I would try stripping your program down to a minimal core that exhibits the buggy behaviour. Often in doing so you will isolate and identify the bug. If not seek help here or in a C (or C++, you don't say which language your program is in) forum. You can post minimal code demonstrating the problem. -- Lionel B