https://bugs.llvm.org/show_bug.cgi?id=41242

            Bug ID: 41242
           Summary: jump table switch also contains a branch (conditional
                    jump to a first case)
           Product: new-bugs
           Version: 7.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Keywords: code-quality
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

int f1();
int f2();
int f3();
int f4();
int f5();

int foo(int i)
{
    switch (i) {
        case 1: return f1();
        case 2: return f2();
        case 3: return f3();
        case 4: return f4();
        case 5: return f5();
    }
    __builtin_unreachable();
}

The branch conditionally jumps to the first case. This happens for different
architectures, and GCC does not do this.

x86_64  https://godbolt.org/z/aYDsUR
ARM     https://godbolt.org/z/j4c0Jf

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to