From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21638 invoked by alias); 3 Dec 2002 16:26:03 -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 21624 invoked by uid 71); 3 Dec 2002 16:26:02 -0000 Date: Tue, 03 Dec 2002 08:26:00 -0000 Message-ID: <20021203162602.21623.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: "Christian Ehrhardt" Subject: Re: optimization/8794: optimization improperly eliminates certain expressions Reply-To: "Christian Ehrhardt" X-SW-Source: 2002-12/txt/msg00153.txt.bz2 List-Id: The following reply was made to PR optimization/8794; it has been noted by GNATS. From: "Christian Ehrhardt" To: pageexec@freemail.hu Cc: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org Subject: Re: optimization/8794: optimization improperly eliminates certain expressions Date: Tue, 3 Dec 2002 17:24:08 +0100 On Tue, Dec 03, 2002 at 02:29:05PM -0000, pageexec@freemail.hu wrote: > >Number: 8794 > >Category: optimization > >Synopsis: optimization improperly eliminates certain expressions > >Release: gcc 3.2.1 Confirmed on i686. The orignal example works ok on sparc but a slightly simplified example produces bad code on sparc with 3.2.1 and 3.3: ------------- cut ------------------ unsigned int addr; void f (void) { addr = (1024 & (1024UL - (addr & 1023UL))); } ------------- cut ------------------ Is compiled into: ------------- cut ------------------ .file "8794.c" .section ".text" .align 4 .global f .type f,#function .proc 020 f: !#PROLOGUE# 0 !#PROLOGUE# 1 mov 1024, %o1 sethi %hi(addr), %o0 retl st %o1, [%o0+%lo(addr)] .LLfe1: .size f,.LLfe1-f .common addr,4,4 .ident "GCC: (GNU) 3.2.1 20021111 (prerelease)" ------------- cut ------------------ Which is clearly wrong. The necessary instructions are elimiated by between 8794.c.15.life and 8794.c.16.combine. regards Christian -- THAT'S ALL FOLKS!