This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Request of new __attribute__ for switch statements (elimination of the bounds check)


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]