From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12822 invoked by alias); 17 Feb 2003 23:16:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 12789 invoked by uid 71); 17 Feb 2003 23:16:00 -0000 Resent-Date: 17 Feb 2003 23:16:00 -0000 Resent-Message-ID: <20030217231600.12787.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, richard@wetafx.co.nz Received: (qmail 10431 invoked by uid 48); 17 Feb 2003 23:12:57 -0000 Message-Id: <20030217231257.10430.qmail@sources.redhat.com> Date: Mon, 17 Feb 2003 23:16:00 -0000 From: richard@wetafx.co.nz Reply-To: richard@wetafx.co.nz To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: optimization/9736: same fp comparison can lead to different results X-SW-Source: 2003-02/txt/msg00745.txt.bz2 List-Id: >Number: 9736 >Category: optimization >Synopsis: same fp comparison can lead to different results >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Mon Feb 17 23:16:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: richard@wetafx.co.nz >Release: g++3 (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7) >Organization: >Environment: Linux 2.4.18-xfssmp #1 SMP i686 >Description: //////////bug.cc: void access(const float&) {} int test(float t) { float v = 0.75f+t; int test1 = v < 1.0f ? 1 : 2; int test2 = v < 1.0f ? 1 : 2; access(v); return test1*10+test2; } int main(void) { return test(0.25f-1.0f/67108864.0f); } //////////GNUmakefile bug: bug.cc; g++3 -O1 -o bug bug.cc >How-To-Repeat: With the two specified files, use gmake to build. With -O1, the values computed for test1 and test2 are different while the source code is identical. >Fix: Can use the -ffloat-store option, but that is a mighty big hammer. >Release-Note: >Audit-Trail: >Unformatted: