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

Glen Joseph Fernandes <glenjofe at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |glenjofe at gmail dot com

--- Comment #1 from Glen Joseph Fernandes <glenjofe at gmail dot com> ---
Interestingly, I observed that moving the default label first produces a better
result:

    void f(int);
    void h(unsigned i)
    {
        switch (i) {
        default: __builtin_unreachable();
        case 0: f(42); break;
        case 1: f(42); break;
        case 2: f(42); break;
        case 3: f(42); break;
        case 4: f(42); break;
        case 5: f(42); break;
        }
    }

At -O2 or higher generates:

    h(unsigned int):
      mov edi, 42
      jmp f(int)

Reply via email to