From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7591 invoked by alias); 8 Mar 2002 00:06:02 -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 7552 invoked by uid 71); 8 Mar 2002 00:06:01 -0000 Resent-Date: 8 Mar 2002 00:06:01 -0000 Resent-Message-ID: <20020308000601.7551.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, janis187@us.ibm.com Received:(qmail 31175 invoked by uid 61); 7 Mar 2002 23:56:58 -0000 Message-Id:<20020307235658.31173.qmail@sources.redhat.com> Date: Thu, 07 Mar 2002 16:06:00 -0000 From: janis187@us.ibm.com Reply-To: janis187@us.ibm.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: middle-end/5877: negative offset to array index leads to inefficient code X-SW-Source: 2002-03/txt/msg00260.txt.bz2 List-Id: >Number: 5877 >Category: middle-end >Synopsis: negative offset to array index leads to inefficient code >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: pessimizes-code >Submitter-Id: net >Arrival-Date: Thu Mar 07 16:06:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Janis Johnson >Release: gcc version 3.1 20020307 (prerelease) >Organization: >Environment: Itanium, Red Hat 7.1.94 (Roswell) >Description: This test case, when compiled on ia64-unknown-linux-gnu with the current 3.1 branch or the current mainline, with any level of optimization, splits up the RHS integer value into individual bytes and then stores them one at a time. The behavior started with this change, which seems to have exposed a latent problem: 2002-02-20 Roger Sayle Jakub Jelinek PR c/4389 * tree.c (host_integerp): Ensure that the constant integer is representable in a HOST_WIDE_INT or an unsigned HOST_WIDE_INT when pos is zero or non-zero respectively. Clarify comment. * c-format.c (check_format_info_recurse): Fix host_integerp usage; the pos argument should be zero when assigning to a signed HOST_WIDE_INT. The test case has an array offset that is a negative value but whose tree node says that it is unsigned. The old version of post_integerp returned 1 for that value and POS of 0, but now it returns 0. The creation of the array offset and the call to post_integerp all happen within expand_assignment. My first attempts to fix this caused ICEs, so I'll leave it to someone who understands this code and get back to other things. This behavior (eight single-byte stores instead of one eight-byte store) is a regression from 3.0.4. >How-To-Repeat: Compile the following test case on ia64 and examine the generated instructions. There should be a single 8-byte store to the array element within the loop rather than a series of 1-byte stores. long a[1004]; void foo () { int i; for (i = 4; i < 1004; i++) a[i-4] = i; } >Fix: Unknown. >Release-Note: >Audit-Trail: >Unformatted: