From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23520 invoked by alias); 14 Oct 2002 16:35:07 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 23478 invoked from network); 14 Oct 2002 16:35:06 -0000 Received: from unknown (HELO mail-out1.apple.com) (17.254.0.52) by sources.redhat.com with SMTP; 14 Oct 2002 16:35:06 -0000 Received: from mailgate1.apple.com (A17-128-100-225.apple.com [17.128.100.225]) by mail-out1.apple.com (8.11.3/8.11.3) with ESMTP id g9EGZ6i12889 for ; Mon, 14 Oct 2002 09:35:06 -0700 (PDT) Received: from scv3.apple.com (scv3.apple.com) by mailgate1.apple.com (Content Technologies SMTPRS 4.2.5) with ESMTP id ; Mon, 14 Oct 2002 09:34:55 -0700 Received: from apple.com (johada5.apple.com [17.201.20.185]) by scv3.apple.com (8.11.3/8.11.3) with ESMTP id g9EGZ5O00968; Mon, 14 Oct 2002 09:35:05 -0700 (PDT) Date: Mon, 14 Oct 2002 10:09:00 -0000 Subject: Re: Request of new __attribute__ for switch statements (elimination of the bounds check) Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v546) Cc: Dale Johannesen , Kevin Lawton , gcc@gcc.gnu.org To: Richard Zidlicky From: Dale Johannesen In-Reply-To: <20021013235837.A657@linux-m68k.org> Message-Id: Content-Transfer-Encoding: 7bit X-SW-Source: 2002-10/txt/msg00710.txt.bz2 >> For implementation of machine simulators, it's quite common >> to have completely populated switch statements on byte values: >> >> unsigned char byte; >> >> switch (byte) { >> case 0: >> case 1: >> ... >> case 255: >> } >> >> But I don't know of any way to tell the compiler to _not_ generate >> a bounds check on the switch variable 'byte'. All of the target >> space is covered. There is a value-range-propagation branch that will do it. Comes at a considerable cost in compile time though.