This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Request of new __attribute__ for switch statements (elimination of the bounds check)
- From: dewar at gnat dot com (Robert Dewar)
- To: gcc at gcc dot gnu dot org, kevinlawton2001 at yahoo dot com
- Date: Fri, 11 Oct 2002 15:08:58 -0400 (EDT)
- Subject: Re: Request of new __attribute__ for switch statements (elimination of the bounds check)
<<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 )) {
...
}
>>
Surely this is NOT the solution in a case when it is obvious that no
check is needed. We have noticed this junk check being a problem in
GNAT, and what we do is to turn the last case into a default, but this
of course is definitely not optimial.