From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27243 invoked by alias); 12 Oct 2011 14:17:00 -0000 Received: (qmail 27224 invoked by uid 22791); 12 Oct 2011 14:16:59 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Oct 2011 14:16:46 +0000 From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/50189] [4.5/4.6 Regression] Wrong code error in -O2 [-fstrict-enums] compile, target independent Date: Wed, 12 Oct 2011 14:17:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: major X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.5.4 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg01112.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50189 --- Comment #13 from rguenther at suse dot de 2011-10-12 14:15:56 UTC --- On Wed, 12 Oct 2011, pkoning at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50189 > > --- Comment #12 from Paul Koning 2011-10-12 14:04:30 UTC --- > You said "GCC treats types compatible when they have the same precision". > That's where the problem lies, because enums with -fstrict-enums have their > precision set to just enough bits to hold the range of values, rather than the > precision of the base integer type. So in the test case in question, the > variable's precision is 32 bits while the right hand side precision is 2 bits. Well. At least we lose the conversion then here: const unsigned int D.2189; position_t D.2188; : D.2189_2 = this_1(D)->m_timestamp; D.2188_3 = MIN_EXPR ; return D.2188_3; I'll look into that. Richard.