From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31624 invoked by alias); 1 Jun 2005 01:55:01 -0000 Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org Received: (qmail 31364 invoked by uid 48); 1 Jun 2005 01:54:45 -0000 Date: Wed, 01 Jun 2005 01:55:00 -0000 From: "tromey at gcc dot gnu dot org" To: java-prs@gcc.gnu.org Message-ID: <20050601015434.21855.tromey@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug java/21855] New: array bounds checking elimination X-Bugzilla-Reason: CC X-SW-Source: 2005-q2/txt/msg00644.txt.bz2 List-Id: public class q { public static void main(String[] args) { for (int i = 0; i < args.length; ++i) System.out.println(args[i]); } } Right now you will get an unnecessary array bounds check at 'args[i]'. BTW we implement this check with an unsigned comparison to also weed out negative indices. Also, an array's size is fixed at its creation. We ought to be able to constant propagate in code like this: int[] array = new int[256]; for (int i = 0; i < array.length; ++i) { ... } ... but afaik there is no way for the front end of the value of 'array.length' -- Summary: array bounds checking elimination Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: java AssignedTo: dnovillo at redhat dot com ReportedBy: tromey at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21855