From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 730 invoked by alias); 4 Dec 2012 09:03:35 -0000 Received: (qmail 361 invoked by uid 55); 4 Dec 2012 09:02:20 -0000 From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/55559] [4.6/4.7/4.8 Regression] Marshalling double through union with inlines, incorrect behavior with -O2 Date: Tue, 04 Dec 2012 09:03:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.6.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: 2012-12/txt/msg00325.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55559 --- Comment #8 from rguenther at suse dot de 2012-12-04 09:02:00 UTC --- On Mon, 3 Dec 2012, mpreda at gmail dot com wrote: > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55559 > > --- Comment #7 from Mihai Preda 2012-12-03 22:13:03 UTC --- > Thanks, I didn't realize that (unsigned)-1.0 is undefined. > > For the behavior I was expecting it's enough to use an intermediary cast > through int, e.g. (unsigned)(int)-1.0. Yes, that makes it implementation-defined (and all implementations I know of do what you expect, modulo-two reduction). > It may be nice to generate a consistent (-O0/-O1) result for (unsigned)-1.0 > though, even if not required by the standard. That's unfortunately generally impossible.