https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93808

--- Comment #16 from Oleg Endo <olegendo at gcc dot gnu.org> ---
This seems to be actually valid code?!

  switch (e - p)
  {
    default: __builtin_unreachable();
    case 3: if (e[-3]&0x80) return e-3;
    case 2: if (e[-2]&0x80) return e-2;
    case 1: if (e[-1]&0x80) return e-1;
    case 0: return ((void *)0);
  }

gets compiled to

.L101:
        sub     r3,r1           ! 465   [c=4 l=2]  *subsi3_internal
        mov     r1,r3           ! 1083  [c=4 l=2]  movsi_i/1
.L33:
        mov     #3,r7           ! 469   [c=4 l=2]  movsi_i/2
        cmp/hi  r7,r3           ! 474   [c=4 l=2]  cmpgtusi_t

                ! when here: T bit = r3 > #3
                ! this is the 'default' case
.L153:
                ! always branch into nowhere
        bt      .L11            ! 475   [c=17 l=2]  *cbranch_t <<< bad jump


So somehow it hits the case that is supposed to be unreachable.

Reply via email to