[llvm-bugs] [Bug 41242] New: jump table switch also contains a branch (conditional jump to a first case)

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 26 08:56:35 PDT 2019


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: unassignedbugs at nondot.org
          Reporter: nok.raven at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190326/63830de5/attachment.html>


More information about the llvm-bugs mailing list