switch index optimization

Richard Henderson rth@cygnus.com
Sun Jan 25 22:34:00 GMT 1998


The talk on linux-kernel about the bogus non-void function returns
without a value warning you get from

  int foo(int x, int y) {
    switch (x & 3) { 
      case 0: ...; return y;
      case 1: ...; return y;
      case 2: ...; return y;
      case 3: ...; return y;
    }
  }

got me thinking.  The following patch won't actually fix this case,
since this is below the threshold for a tablejump, but it points the
way, and does do some good.  

Or should this go somewhere else like jump?


r~


More information about the Gcc mailing list