From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4931 invoked by alias); 27 Nov 2008 11:42:19 -0000 Received: (qmail 4921 invoked by uid 22791); 27 Nov 2008 11:42:18 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Nov 2008 11:41:43 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id mARBffWc003160; Thu, 27 Nov 2008 06:41:41 -0500 Received: from zebedee.pink (vpn-12-81.rdu.redhat.com [10.11.12.81]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id mARBfeIV026218; Thu, 27 Nov 2008 06:41:40 -0500 Message-ID: <492E8774.4080507@redhat.com> Date: Thu, 27 Nov 2008 14:33:00 -0000 From: Andrew Haley User-Agent: Thunderbird 2.0.0.18 (X11/20081105) MIME-Version: 1.0 To: Andrzej Giniewicz CC: "gcc-help@gcc.gnu.org" Subject: Re: Need some clarification about optimization flags, what "exactly" does -O1 do? References: <492E830A.3070607@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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-11/txt/msg00318.txt.bz2 Andrzej Giniewicz wrote: >> What does the declaration of IndexType look like? > > nothing special: > > enum IndexType { > IT_16BIT, > IT_32BIT > }; > >> The bug is probably in your app, not in gcc. >> I think you'd be much better off fixing the bug than trying to >> discover which optimization pass it breaks. > > not quite my app just app I try to build, i.e. developer seems to not > have gcc 4.3 yet and I am just trying to get it on :) To be more > precise - the value that is defined as: > > ... ? HardwareIndexBuffer::IT_32BIT : HardwareIndexBuffer::IT_16BIT > > is then checked with: > > switch (mIndexType) > { > case IT_16BIT: > mIndexSize = sizeof(unsigned short); > break; > case IT_32BIT: > mIndexSize = sizeof(unsigned int); > break; > } > > but it don't trigger any of those in anything more than -O0 (if I add > default with cerr<< it is triggered) and works on -O0... I didn't > thought such funny thing can be caused by some bug where code is quite > easy, simple switch on enumerated value that is set to one of two and > not used/changed anywhere else... Yeah, but that bug almost certainly isn't in the code you're looking at. I've recently seen a bug that was triggered by -O in an enum where the declaration was: enum Cell { Cell_0 }; and gcc quite correctly assumed that a Cell could only have one value. I'm not saying I'm absolutely certain this isn't a bug in gcc. It's just that it probably isn't. Andrew.