From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12107 invoked by alias); 19 Jan 2011 21:22:37 -0000 Received: (qmail 12071 invoked by uid 22791); 19 Jan 2011 21:22:35 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-iw0-f175.google.com (HELO mail-iw0-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 19 Jan 2011 21:22:30 +0000 Received: by iwn8 with SMTP id 8so1265845iwn.20 for ; Wed, 19 Jan 2011 13:22:29 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.11.139 with SMTP id t11mr1473552ibt.189.1295472148731; Wed, 19 Jan 2011 13:22:28 -0800 (PST) Received: by 10.231.30.201 with HTTP; Wed, 19 Jan 2011 13:22:28 -0800 (PST) In-Reply-To: References: Date: Wed, 19 Jan 2011 21:22:00 -0000 Message-ID: Subject: Re: Could someone tell me what is wrong here? From: Brian Budge To: =?ISO-8859-1?B?TeF06SBTb/Nz?= Cc: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2011-01/txt/msg00293.txt.bz2 I haven't done an in-depth analysis of your code, but I noticed that in my own code, that casting a bool to an integer type did not always yield 0 or 1 (I believe this was new in 4.5x). I ended up changing from +=3D (uint32_t)mybool to +=3D mybool ? 1 : 0 Does this help in your code? Brian On Wed, Jan 19, 2011 at 1:14 PM, M=E1t=E9 So=F3s wrot= e: > Dear All, > > I maintain a program and I seemed to have stumbled into some bug of > either the program or gcc. Thanks to Vegard Nossum, we have a really > small (101 lines, most of them empty) example to reproduce it. The bug > appears when I compile the program with gcc 4.5.1 (I believe it > appears for 4.5.0 and 4.5.2 as well), with -O2. The program is meant > to print "success", but when compiled with -O2 it returns "failure", > while for -O0 works fine. The file is available here: > > http://planete.inrialpes.fr/~soos/gcc/ > > as "Main.cpp" and "compile.sh". > > Machine it is compiled on: > distribution: Fedora Core 14 > gcc --version: gcc (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4) > uname -a: Linux localhost.localdomain 2.6.35.6-45.fc14.i686 #1 SMP Mon > Oct 18 23:56:17 UTC 2010 i686 i686 i386 GNU/Linux > > This bug seemed to have been triggered in the original (>13'000 LOC) > program by multiple people, using multiple 4.5.X versions, on > different computers&distributions. > > Does anyone know why I get this bug? Could anyone confirm that this > the bug triggers on their architecture, distribution, and compiler > version (only >=3D 4.5.0 seems to be affected)? > > Thank you in advance, > > Mate > > -- > Mate Soos > Security Research Labs > www.srlabs.de > www.msoos.org >