From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32693 invoked by alias); 7 May 2003 16:36: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 32674 invoked by uid 71); 7 May 2003 16:36:00 -0000 Resent-Date: 7 May 2003 16:36:00 -0000 Resent-Message-ID: <20030507163600.32673.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, jkain@nvidia.com Received: (qmail 30958 invoked by uid 48); 7 May 2003 16:32:32 -0000 Message-Id: <20030507163232.30957.qmail@sources.redhat.com> Date: Wed, 07 May 2003 16:36:00 -0000 From: jkain@nvidia.com Reply-To: jkain@nvidia.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: optimization/10667: Optimizer confused when operating on floats as ints. X-SW-Source: 2003-05/txt/msg00483.txt.bz2 List-Id: >Number: 10667 >Category: optimization >Synopsis: Optimizer confused when operating on floats as ints. >Confidential: no >Severity: critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed May 07 16:36:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Joseph Kain >Release: gcc version 3.2.3 >Organization: >Environment: Linux 2.4, i686. >Description: The program below was built as: gcc -v -save-temps -O3 -c -o bug.o bug.c $ gcc -v Reading specs from /home/joseph/t/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/specs Configured with: ../gcc-3.2.3/configure --prefix=/home/joseph/t/gcc Thread model: posix gcc version 3.2.3 If I examine the assembly output I find that the compiler has completely removed the multiply. Code for the compare is generated but the compare result may be wrong since f.x was never computed. >How-To-Repeat: # 1 "bug.c" # 1 "" # 1 "" # 1 "bug.c" struct vector { float x, y, z, w; }; int func (float f1, float f2) { struct vector f; f.x = f1 * f2; if ((*(int *) &(f.x)) > 0) { return 1; } return 0; } >Fix: >Release-Note: >Audit-Trail: >Unformatted: