This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Switch statement: extra out-of-bounds code emitted
- From: John Wehle <john at feith dot com>
- To: dalej at apple dot com
- Cc: cbsears_sf at yahoo dot com, gcc at gcc dot gnu dot org
- Date: Thu, 20 Dec 2001 17:43:42 -0500 (EST)
- Subject: Re: Switch statement: extra out-of-bounds code emitted
> Perhaps more usefully,
>
> switch ( i&7 ) { /* or i%8 */
> case 0: case 1: case 2: case 3: /* case bodies omitted */
> case 4: case 5: case 6: case 7:
> }
>
> could omit the bounds checks. This isn't dependent on the type of i.
VRP currently does remove the bounds check.
-- John
-------------------------------------------------------------------------
| Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com |
| John Wehle | Fax: 1-215-540-5495 | |
-------------------------------------------------------------------------