From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11653 invoked by alias); 18 Dec 2013 15:03:15 -0000 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 Received: (qmail 11643 invoked by uid 89); 18 Dec 2013 15:03:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Dec 2013 15:03:13 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBIF37EQ005113 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 18 Dec 2013 10:03:07 -0500 Received: from oldenburg.str.redhat.com (oldenburg.str.redhat.com [10.33.200.60]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rBIF35al017756 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 18 Dec 2013 10:03:06 -0500 Message-ID: <52B1B929.5040804@redhat.com> Date: Wed, 18 Dec 2013 15:03:00 -0000 From: Florian Weimer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Diggory Hardy , "gcc-help@gcc.gnu.org" Subject: Re: optimisation -O1 changes floating-point results References: <2630496.spIoGH9TqC@yoga.dhardy> In-Reply-To: <2630496.spIoGH9TqC@yoga.dhardy> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00126.txt.bz2 On 12/18/2013 03:23 PM, Diggory Hardy wrote: > Is this a known issue? Yes, it's the excess precision problem on i386: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 > Is it the same with later GCC versions? GCC 4.5 has some fixes. > Is there a way I can turn on most optimisations while still getting exactly > the same results as without optimisation? You could compile with -mfpmath=sse -msse2, or you could set the floating point control word to restrict precision to 53 bits. The latter will cover doubles only, the issue can still surface with floats. -- Florian Weimer / Red Hat Product Security Team