From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19249 invoked by alias); 11 Oct 2002 19:05:22 -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 19197 invoked from network); 11 Oct 2002 19:05:22 -0000 Received: from unknown (HELO web80309.mail.yahoo.com) (66.218.79.25) by sources.redhat.com with SMTP; 11 Oct 2002 19:05:22 -0000 Message-ID: <20021011190521.57024.qmail@web80309.mail.yahoo.com> Received: from [206.149.208.54] by web80309.mail.yahoo.com via HTTP; Fri, 11 Oct 2002 12:05:21 PDT Date: Fri, 11 Oct 2002 13:20:00 -0000 From: Kevin Lawton Subject: Request of new __attribute__ for switch statements (elimination of the bounds check) To: gcc@gcc.gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-10/txt/msg00622.txt.bz2 All, 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. To solve this, could we add an attribute to switch? switch (byte) __attribute (( no-bounds-check )) { ... } This would also be useful for cases, where it is known that all possible targets are covered with case statements, yet they don't appear to be fully populated to the compiler (it's known only to the programmer that the logic prevents certain values). Thanks, -Kevin __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com